From: Alexander Barton Date: Tue, 31 Dec 2019 15:56:50 +0000 (+0100) Subject: axzshctl: Implement "--help" option, and ehnance error handling X-Git-Url: https://arthur.barton.de/gitweb/?p=ax-zsh.git;a=commitdiff_plain;h=a8f02bd2e0dab5a1c1d9d3aec7b34c797e8ee4be axzshctl: Implement "--help" option, and ehnance error handling Don't exit with an error code ("non-null") when the usage information was requested with "--help", and write errors parsing the command line to stderr and exit with code 2. --- diff --git a/bin/axzshctl b/bin/axzshctl index 0c4da38..1c41425 100755 --- a/bin/axzshctl +++ b/bin/axzshctl @@ -51,7 +51,7 @@ function Usage { echo " update-caches" echo " Force rebuild of all cache files." echo - exit 2 + exit 0 } function UpdatePluginCache { @@ -401,6 +401,11 @@ case "$cmd" in [[ $# -eq 0 ]] || Usage UpdatePluginCache ;; - *) + "--help") Usage + ;; + *) + ax_error "Invalid command \"$cmd\"!" + ax_error "Try \"$0 --help\" for more information." + exit 2 esac