summaryrefslogtreecommitdiff
path: root/bin/lsrc.in
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2014-05-30 14:17:32 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2014-05-30 14:58:57 +0200
commit19b5663b9ef06a800831d09a3cbceb937923429d (patch)
tree78bf483d7418e5a4f4b9e922f1dd9ee3c4be967e /bin/lsrc.in
parentcda41b5f2a5e9ab38e340f802503c745f77e681e (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/lsrc.in')
-rwxr-xr-xbin/lsrc.in3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/lsrc.in b/bin/lsrc.in
index 951f3df..ec900a2 100755
--- a/bin/lsrc.in
+++ b/bin/lsrc.in
@@ -229,7 +229,7 @@ handle_command_line() {
local symlink_dirs=
local hostname=
- while getopts FVqvhI:x:B:S:t:d: opt; do
+ while getopts :FVqvhI:x:B:S:t:d: opt; do
case "$opt" in
F) show_sigils=1;;
h) show_help ;;
@@ -242,6 +242,7 @@ handle_command_line() {
x) excludes="$excludes $OPTARG";;
S) symlink_dirs="$symlink_dirs $OPTARG";;
B) hostname="$OPTARG";;
+ ?) show_help 64 ;;
esac
done
shift $(($OPTIND-1))