From 7fd23d80baaf043c607faaf9094e97fbd0a1ff8b Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 11 Aug 2017 13:34:06 +0200 Subject: xlocate: fix option parsing Fixes #66. --- xlocate | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'xlocate') diff --git a/xlocate b/xlocate index 2da6641..1d2d41b 100755 --- a/xlocate +++ b/xlocate @@ -45,16 +45,20 @@ xsyncgit() { git -C "$XLOCATE_GIT" fetch -u -f "$XLOCATE_REPO" master:master } -if [ "$1" = -g ]; then +case "$1" in +-g) xupdategit - exit $? -elif [ "$1" = -S ]; then + exit $?;; +-S) xsyncgit - exit $? -else + exit $?;; +-*) echo "xlocate: invalid option '$1'" 1>&2 - exit 1 -fi + exit 1;; +'') + echo "Usage: xlocate [-g | -S | PATTERN]" 1>&2 + exit 1;; +esac if [ -d "$XLOCATE_GIT" ]; then if [ -f "$XLOCATE_GIT/refs/heads/master" ]; then -- cgit 1.4.1