diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-09-27 16:53:58 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-09-27 16:53:58 +0000 |
commit | 966ff3a185ba150625cd14022392d310cf9c1649 (patch) | |
tree | c6a9ee0cfec16bb70e1b36a091fb9b6fab9fb396 /Completion/Base/Utility | |
parent | 11dc3a29cf2556f7b29d3d92570191a3a3c43dbb (diff) | |
download | zsh-966ff3a185ba150625cd14022392d310cf9c1649.tar.gz zsh-966ff3a185ba150625cd14022392d310cf9c1649.tar.xz zsh-966ff3a185ba150625cd14022392d310cf9c1649.zip |
22780: add _arguments/comparguments -n to set index of first non-option arg
Diffstat (limited to 'Completion/Base/Utility')
-rw-r--r-- | Completion/Base/Utility/_arguments | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 05a287a5f..a87486168 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -5,6 +5,7 @@ local long cmd="$words[1]" descr mesg subopts opt usecc autod local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt +local setnormarg long=$argv[(I)--] if (( long )); then @@ -189,12 +190,13 @@ fi subopts=() singopt=() -while [[ "$1" = -(O*|[CRWsw]) ]]; do +while [[ "$1" = -(O*|[CRWnsw]) ]]; do case "$1" in -C) usecc=yes; shift ;; -O) subopts=( "${(@P)2}" ); shift 2 ;; -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;; -R) rawret=yes; shift;; + -n) setnormarg=yes; NORMARG=-1; shift;; -w) optarg=yes; shift;; -s) singopt=(-s); shift;; -W) alwopt=arg; shift;; @@ -251,6 +253,10 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then descr="$descrs[anum]" subc="$subcs[anum++]" + if [[ $subc = argument* && -n $setnormarg ]]; then + comparguments -n NORMARG + fi + if [[ -n "$matched" ]] || _requested "$subc"; then curcontext="${oldcontext%:*}:$subc" |