diff --git a/apollo.sh b/apollo.sh index 0649841c9b2c14a642a09adfff6435d71cd61c0e..769dcb3b112149b14f4b10c516862f483d0687bb 100755 --- a/apollo.sh +++ b/apollo.sh @@ -124,7 +124,7 @@ function _usage() { ${BLUE}doc${NO_COLOR}: generate doxygen document ${BLUE}clean${NO_COLOR}: cleanup bazel output and log/coredump files ${BLUE}format${NO_COLOR}: format C++/Python/Bazel/Shell files - ${BLUE}usage${NO_COLOR}: show this message + ${BLUE}usage${NO_COLOR}: show this message and exit " } @@ -199,7 +199,7 @@ function main() { env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_lint.sh" cpp ;; clean) - env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_clean.sh" "-a" + env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_clean.sh" "$@" ;; doc) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_docs.sh" "$@" diff --git a/scripts/apollo_clean.sh b/scripts/apollo_clean.sh index 89855accc8ef68d52da33a97dfa506fde3eba662..03d0d2c47a266de64fa4c8e5d6a7760f74e43821 100755 --- a/scripts/apollo_clean.sh +++ b/scripts/apollo_clean.sh @@ -38,9 +38,9 @@ function _clean_bazel_cache() { # Remove bazel cache in associated directories if [ -d /apollo-simulator ]; then - pushd /apollo-simulator > /dev/null + pushd /apollo-simulator >/dev/null bazel clean ${opt} - popd > /dev/null + popd >/dev/null fi } @@ -75,11 +75,15 @@ function _print_usage() { echo "${TAB}--log Remove log files" echo "${TAB}-a, --all Equivalent to \"--bazel --core --log\"" echo "${TAB}--expunge Run \"bazel clean --expunge\"" - - echo "${TAB}-h, --help Show this message" + echo "${TAB}-h, --help Show this message and exit" } function parse_arguments() { + if [[ $# -eq 0 ]]; then + _print_usage + exit 1 + fi + while [ $# -gt 0 ]; do local opt="$1" shift