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

Re: Feature Patch: Use completion to view parameter values



Marlon Richert wrote on Sun, Mar 28, 2021 at 23:53:29 +0300:
> +++ b/Completion/Zsh/Type/_parameters
> @@ -32,8 +37,18 @@ zstyle -t ":completion:${curcontext}:parameters"
> +if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; then
> +  zstyle -s ":completion:${curcontext}:parameters" list-separator sep ||
> +    sep=--
> +  zformat -a disp " $sep " ${matches[@]:/(#m)*/"${MATCH}:${(Pkv@q+)MATCH}"}

What about parameters implemented by modules?  The getters of those may
run arbitrary code, and may have side effects: e.g., imagine an
$AUTOINCREMENT parameter that returns an incremented-by-one value every
time it's evaluated:

    % repeat 3 echo $AUTOINCREMENT
    1
    2
    3
    % echo $AUTOINCR<TAB><Enter>

Wouldn't that print «5»?

Cheers,

Daniel


> +  disp=( "${disp[@]:/(#m)*/$MATCH[1,COLUMNS]}" )
> +  dopt=( -d disp )
> +fi




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