|
|
@ -61,6 +61,16 @@ function op_get_openpilot_dir() { |
|
|
|
done |
|
|
|
done |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function op_install_post_commit() { |
|
|
|
|
|
|
|
op_get_openpilot_dir |
|
|
|
|
|
|
|
if [[ ! -d $OPENPILOT_ROOT/.git/hooks/post-commit.d ]]; then |
|
|
|
|
|
|
|
mkdir $OPENPILOT_ROOT/.git/hooks/post-commit.d |
|
|
|
|
|
|
|
mv $OPENPILOT_ROOT/.git/hooks/post-commit $OPENPILOT_ROOT/.git/hooks/post-commit.d 2>/dev/null || true |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
cd $OPENPILOT_ROOT/.git/hooks |
|
|
|
|
|
|
|
ln -sf ../../scripts/post-commit post-commit |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function op_check_openpilot_dir() { |
|
|
|
function op_check_openpilot_dir() { |
|
|
|
echo "Checking for openpilot directory..." |
|
|
|
echo "Checking for openpilot directory..." |
|
|
|
if [[ -f "$OPENPILOT_ROOT/launch_openpilot.sh" ]]; then |
|
|
|
if [[ -f "$OPENPILOT_ROOT/launch_openpilot.sh" ]]; then |
|
|
@ -327,6 +337,7 @@ function op_default() { |
|
|
|
echo -e "${BOLD}${UNDERLINE}Commands [Testing]:${NC}" |
|
|
|
echo -e "${BOLD}${UNDERLINE}Commands [Testing]:${NC}" |
|
|
|
echo -e " ${BOLD}sim${NC} Run openpilot in a simulator" |
|
|
|
echo -e " ${BOLD}sim${NC} Run openpilot in a simulator" |
|
|
|
echo -e " ${BOLD}lint${NC} Run the linter" |
|
|
|
echo -e " ${BOLD}lint${NC} Run the linter" |
|
|
|
|
|
|
|
echo -e " ${BOLD}post-commit${NC} Install the linter as a post-commit hook" |
|
|
|
echo -e " ${BOLD}test${NC} Run all unit tests from pytest" |
|
|
|
echo -e " ${BOLD}test${NC} Run all unit tests from pytest" |
|
|
|
echo "" |
|
|
|
echo "" |
|
|
|
echo -e "${BOLD}${UNDERLINE}Options:${NC}" |
|
|
|
echo -e "${BOLD}${UNDERLINE}Options:${NC}" |
|
|
@ -372,6 +383,7 @@ function _op() { |
|
|
|
replay ) shift 1; op_replay "$@" ;; |
|
|
|
replay ) shift 1; op_replay "$@" ;; |
|
|
|
sim ) shift 1; op_sim "$@" ;; |
|
|
|
sim ) shift 1; op_sim "$@" ;; |
|
|
|
install ) shift 1; op_install "$@" ;; |
|
|
|
install ) shift 1; op_install "$@" ;; |
|
|
|
|
|
|
|
post-commit ) shift 1; op_install_post_commit "$@" ;; |
|
|
|
* ) op_default "$@" ;; |
|
|
|
* ) op_default "$@" ;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
} |
|
|
|
} |
|
|
|