zsh-workers
 help / color / Atom feed
From: dana <dana@dana.is>
To: Aurélien <orel_jf@yahoo.fr>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: help for writing GNU stow completion
Date: Sat, 24 Aug 2019 20:14:17 -0500
Message-ID: <707548C8-840F-449C-BCE4-3E406F6FACD2@dana.is> (raw)
In-Reply-To: <558a3ff8-d6f1-9ab0-3387-a17ca5e0e75b@yahoo.fr>

(idk what's up with the ???? here, it says UTF-8 but it's all messed up)

On 20 Aug 2019, at 12:45, Aurélien <orel_jf@yahoo.fr> wrote:
> But now if I do ?? stow --dir=$HOME/.dotfiles<TAB> ??, I get ????no packages
> found in $HOME/.dotfiles????. Maybe I missed something???

It's because of what i said before — the argument you're passing to that
helper function is the raw, unevaluated text from the command line, so it
isn't expanding $HOME. The only easy way i can think of to *make* a completion
function expand that is to evaluate it, which you can do with eval or, as i
forgot to mention before, the (e) expansion flag. But if you do that, there is
a chance (though probably not a huge one) that you might trigger unexpected
and potentially even destructive side-effects when the user invokes
completion, which is why Daniel objected to it.

If there were some kind of 'safe eval' that just performed 'read-only'
parameter expansions, you could use that, but as far as i know there isn't
currently anything like that that's built into the shell, and it's not ideal
to special-case this one function.

So, without a general solution, the more limited version in your last message
might be the best option for now

dana


  reply index

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
2019-08-17 21:44       ` dana
2019-08-20 17:45       ` Aurélien
2019-08-25  1:14         ` dana [this message]
2019-10-13 17:51           ` Aurélien
2019-10-16  1:14             ` dana

Reply instructions:

You may reply publically 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=707548C8-840F-449C-BCE4-3E406F6FACD2@dana.is \
    --to=dana@dana.is \
    --cc=d.s@daniel.shahaf.name \
    --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

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git