Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: help for writing GNU stow completion
- X-seq: zsh-workers 44680
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: Aurélien <orel_jf@xxxxxxxx>, dana <dana@xxxxxxx>
- Subject: Re: help for writing GNU stow completion
- Date: Sat, 17 Aug 2019 17:53:09 +0000
- Cc: zsh-users <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type :content-transfer-encoding; s=fm1; bh=onP1UoXnrOWBJxm8xVqlq314ni 5DSTxoyKI6iLoaebE=; b=in6ngmeWT8NOXcDww4djAY4feh0CpdFys/E5iVVdnu 72qH0sEq8aQMq4ihe+Yvho/MhaujfpQgBdAy7NPl/DNW80gb6PLrwUieuwqkVo01 lt2npERajYmnXJTyLDzMTAFEegmgSOwnqK1hlBnbWrvcCRLg95jFQ0h5l9IOJ1Hp dyKaAle+DJO4ozLE3i1uba2xg3P8t6wptG2ZVJH6s/R8WptHbXdd77+7Rkkilp7Q UIm8DDMJi6ZQIRJZi099KEsasktzQ1ABc9jJthxgsBh9FvC8oB0Lz/Rp0aLNmc8G MJEG62dHgoLmssYSXM+P7ax0KFYyNOYC30gfnRcjy6wQ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=onP1UoXnrOWBJxm8xVqlq314ni5DSTxoyKI6iLoae bE=; b=ePnGSz91axTkOAc3iLqL6ff/+ZsHG4D/zw++T8KQtqtP5Eb14caHCr2Q+ mQkP9YAff8l45nLjwkzIdvGkl5pdmHDkWasFSCZd8GEoCCyWqKJ4132dazoMLBuB lKF8aE4OXH/NiQJ6iFn94otkUqZU80QEXAw6GV8OukaGn8zDVWRCho5bzOvkyjtC JL70fG6w3qjHakLB/VnrfNdKQw6y464eIRGWPccq+Rft5WxiFZSoH8xTzd68v1+3 iIDAXyXpmRN6tTDSg1KN8Vwk0CVryk2qdvQ53yMI9nl/YqNepdktZAhVcgLOcWjk ADpEJSI4l5XyjAzxon2dzkWdF55mg==
- In-reply-to: <d30637f3-cbbb-8b93-35f2-421a1a99e1dc@yahoo.fr>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1e5195bb-3126-8d0c-8a6a-1f5a5fd2a6c0@yahoo.fr> <BAE67462-BF39-481A-BCD6-DE288FE6CC92@dana.is> <d30637f3-cbbb-8b93-35f2-421a1a99e1dc@yahoo.fr>
[moving to -workers@ since it's about an outstanding PR]
Aurélien wrote on Sat, 17 Aug 2019 07:51 +00:00:
> local stow_dir
> local -a stow_pkg_list
>
> eval set -A stow_dir $1
> [[ -n $stow_dir ]] && stow_pkg_list=( $stow_dir/*(-/N:t) )
>
> if [[ ${#stow_pkg_list} -gt 0 ]]; then
> _values -C "packages from $stow_dir" ${stow_pkg_list[@]}
> else
> _message "no packages found in $stow_dir"
> fi
>
> and the completion of parameters such as'$HOME' or'~/' works well !
>
> I pushed my modifications on github. Thank you for the answers :-)
Sorry, but I have to object to the PR as it stands. As I said, using
«eval $1» causes expressions on the command line to be evaluated
_when completion is attempted_. To me, that breaks the principle of
least surprise, and could lead to unexpected and undesired results.
I would strongly prefer another solution, or to be corrected on my
interpretation that this violates least surprise.
Also, I don't think it's ideal to have «foo --opt=$ARG<TAB>» work and
«bar --opt=$ARG<TAB>» not work.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author