diff options
author | Mike Burns <mike@mike-burns.com> | 2014-05-30 14:17:32 +0200 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2014-05-30 14:58:57 +0200 |
commit | 19b5663b9ef06a800831d09a3cbceb937923429d (patch) | |
tree | 78bf483d7418e5a4f4b9e922f1dd9ee3c4be967e /bin/mkrc.in | |
parent | cda41b5f2a5e9ab38e340f802503c745f77e681e (diff) |
On bad args, show usage and exit
The lsrc(1), mkrc(1), rcup(1), and rcdn(1) commands will now print a
usage message and exit immediately (with 64, `EX_USAGE`) when given an
option it does not understand.
This includes `--version` and `--help`.
Normal `-h` will print usage and exit successfully, as normal.
Closes #59.
Diffstat (limited to 'bin/mkrc.in')
-rwxr-xr-x | bin/mkrc.in | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/mkrc.in b/bin/mkrc.in index 9af0b6a..6545e55 100755 --- a/bin/mkrc.in +++ b/bin/mkrc.in @@ -30,7 +30,7 @@ show_help() { } if [ $# -eq 0 ]; then - show_help 1 + show_help 64 fi for DOTFILES_DIR in $DOTFILES_DIRS $DEFAULT_DOTFILES_DIR; do @@ -46,7 +46,7 @@ always_copy=0 force_symlink=0 install_args= -while getopts ChSsVvqot:d:B: opt; do +while getopts :ChSsVvqot:d:B: opt; do case "$opt" in C) always_copy=1 ;; h) show_help ;; @@ -63,6 +63,7 @@ while getopts ChSsVvqot:d:B: opt; do hostname="$OPTARG" install_args="-B $hostname" ;; + ?) show_help 64 ;; esac done shift $(($OPTIND-1)) |