Allow options to be combined e.g -clt

This commit is contained in:
rupa committed 2013-03-03 02:49:11 -05:00
1 parent f5e4ff6a26
commit 76852ebb49
2 files changed
+8 -6

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ NAME
z \- jump around
.SH
SYNOPSIS
z [\-c] [\-h] [\-l] [\-r] [\-t] [regex1 regex2 ... regexn]
z [\-chlrt] [regex1 regex2 ... regexn]
.SH
AVAILABILITY
bash, zsh
+7 -5
View File
@@ -101,12 +101,14 @@ _z() {
else
# list/go
while [ "$1" ]; do case "$1" in
-c) local fnd="$PWD $fnd";;
-h) echo "${_Z_CMD:-z} [-c][-h][-l][-r][-t] args" >&2; return;;
-l) local list=1;;
-r) local typ="rank";;
-t) local typ="recent";;
--) while [ "$1" ]; do shift; local fnd="$fnd $1";done;;
-*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
c) local fnd="$PWD $fnd";;
h) echo "${_Z_CMD:-z} [-chlrt] args" >&2; return;;
l) local list=1;;
r) local typ="rank";;
t) local typ="recent";;
esac; opt=${opt:1}; done;;
*) local fnd="$fnd $1";;
esac; local last=$1; shift; done
[ "$fnd" -a "$fnd" != "$PWD " ] || local list=1