zsh-workers
 help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: Aurélien <orel_jf@yahoo.fr>, dana <dana@dana.is>
Cc: zsh-users <zsh-workers@zsh.org>
Subject: Re: help for writing GNU stow completion
Date: Sat, 17 Aug 2019 17:53:09 +0000	[thread overview]
Message-ID: <0618d7fc-5334-4e51-829a-8684a81744c1@www.fastmail.com> (raw)
In-Reply-To: <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

       reply	other threads:[~2019-08-18 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1e5195bb-3126-8d0c-8a6a-1f5a5fd2a6c0@yahoo.fr>
     [not found] ` <BAE67462-BF39-481A-BCD6-DE288FE6CC92@dana.is>
     [not found]   ` <d30637f3-cbbb-8b93-35f2-421a1a99e1dc@yahoo.fr>
2019-08-17 17:53     ` Daniel Shahaf [this message]
2019-08-17 21:44       ` dana
2019-08-20 17:45       ` Aurélien
2019-08-25  1:14         ` dana
2019-10-13 17:51           ` Aurélien
2019-10-16  1:14             ` dana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0618d7fc-5334-4e51-829a-8684a81744c1@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=dana@dana.is \
    --cc=orel_jf@yahoo.fr \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).