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 /Src/Zle/computil.c | |
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 'Src/Zle/computil.c')
-rw-r--r-- | Src/Zle/computil.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 17eb7a8df..bde1f79af 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -2371,6 +2371,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) case 'M': min = 1; max = 1; break; case 'a': min = 0; max = 0; break; case 'W': min = 2; max = 2; break; + case 'n': min = 1; max = 1; break; default: zwarnnam(nam, "invalid option: %s", args[0]); return 1; @@ -2665,6 +2666,20 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) sethparam(args[2], ret); } return 0; + case 'n': + /* + * This returns the array index of the word where normal + * arguments began. It uses optbeg rather than nargbeg + * (the value used when parsing) because nargbeg is assigned + * to optbeg in the returned value and nargbeg isn't + * used. + * + * -->PLEASE DON'T ASK<-- + * + * Thank you. + */ + setiparam(args[1], (zlong)ca_laststate.optbeg + !isset(KSHARRAYS)); + return 0; } return 1; } |