Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: parameter substitution used in _values



Sven Wischnowsky wrote:
> 
> The problem is that the positional parameters are internally turned into
> `$argv[n]'.  And, as one can see,

Ah, that explains.

> In the shell code we have to use `${(@P)${1[1,3]}}' for now.  Oliver, if
> you have your hands in there anyway, could you?

Okay. I assume you meant ${(@P)${1[3,-1]}} and this change does that and
the same for a similar piece of code in _arguments. I was looking at
using zparseopts to handle more options but I won't change it to that
this close to the release.

Does `opt' need to be declared local in _values for any reason or is
that some old leftover?

Oliver

Index: Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.6
diff -u -r1.6 _arguments
--- Base/Utility/_arguments     2001/05/31 12:38:34     1.6
+++ Base/Utility/_arguments     2001/06/01 14:13:20
@@ -178,7 +178,7 @@
   case "$1" in
   -C)  usecc=yes; shift ;;
   -O)  subopts=( "${(@P)2}" ); shift 2 ;;
-  -O*) subopts=( "${(@P)1[3,-1]}" ); shift ;;
+  -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
   -R)  rawret=yes; shift;;
   -w)  optarg=yes; shift;;
   -s)  singopt=(-s); shift;;
Index: Base/Utility/_values
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_values,v
retrieving revision 1.3
diff -u -r1.3 _values
--- Base/Utility/_values        2001/05/31 08:18:37     1.3
+++ Base/Utility/_values        2001/06/01 14:13:20
@@ -7,7 +7,7 @@
   case "$1" in
   -C) usecc=yes; shift ;;
   -O) subopts=( "${(@P)2}" ); shift 2 ;;
-  *)  subopts=( "${(@P)1[3,-1]}" ); shift ;;
+  *)  subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
   esac
 done



Messages sorted by: Reverse Date, Date, Thread, Author