summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-08-11 13:34:06 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-08-11 13:34:06 +0200
commit7fd23d80baaf043c607faaf9094e97fbd0a1ff8b (patch)
tree5e3178327e3672270d9056d0ecb274cbad3f9011
parent59bcfada7cacf4b0cd92029023a4aaf2cf105340 (diff)
downloadxtools-0.48.tar.gz
xtools-0.48.tar.xz
xtools-0.48.zip
xlocate: fix option parsing v0.48
Fixes #66.
-rwxr-xr-xxlocate18
1 files changed, 11 insertions, 7 deletions
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