Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: The zsh equivalent to Bash's "complete -W" to complete a command using only a list of words
- X-seq: zsh-users 21435
- From: Shlomi Fish <shlomif@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: The zsh equivalent to Bash's "complete -W" to complete a command using only a list of words
- Date: Sat, 9 Apr 2016 16:40:52 +0300
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=8t52rADiY4LVru6Q2qwenYAxkAKiO8GO0bFEUpIfong=; b=jOty2i3vUxGPexUPVOd+dNXM7gYiyVbTJSv1OcJ1GHwg5jtEPHamBH5pl/dOsb9vO5 AJ1CY211Z9NWUlaiMXs/RvDe88K7eCT9e0pmxkrk+oC/aWU4zw4UfeGD2zVyhMHhrOti Qf77l+EnaTyFatFJAQOXrAUFRRfWRK9v9pFCTV/HUPXwsP2Ah4la6sPj6XehyIIkiLQ6 hfSagrN5VdtxzoGLPvD8xjEShAEjOVEKMwWZcYqLPhKXbnDrE9/dQj0/BVd6DTDTdfCh h9ajdlnfU700ste5LyLWkMYc8enFJacM+ZC7WJevDSzx91QINuasLr1lLNUg4uyoBKem jBYw==
- In-reply-to: <20160409124553.783683a3@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CANy4znWN6KDopSvzrKQemKRyE9zeTx-yz-ChmOU0q6+XpuNXUw@mail.gmail.com> <20160409124553.783683a3@pwslap01u.europe.root.pri>
Hi Mr. Stephenson!
thanks for your reply.
On Sat, Apr 9, 2016 at 2:45 PM, Peter Stephenson <p.stephenson@xxxxxxxxxxx>
wrote:
> On Sat, 09 Apr 2016 13:27:39 +0300
> Shlomi Fish <shlomif@xxxxxxxxx> wrote:
> > I am looking for the zsh equivalent of this bash command to complete a
> > command using a list of words:
> >
> > complete -W "$(cat ${__themes_dir}/list-of-themes.txt)"
> "Theme"
> >
> > In bash, I can do Theme[space][tab] and it will give me completions only
> > from the designated words / options / strings.
>
> Assuming you have the completion system already loaded, the following is
> a fairly standard way of doing it. The "_wanted" business makes it fit
> in with the standard conventions.
>
> pws
>
>
> _Theme() {
> local expl
> local -a themes
> themes=($(<${__themes_dir}/list-of-themes.txt))
> _wanted tests expl -a themes
> }
> compdef _Theme Theme
>
In addition to that I was told on IRC that I can do this:
compdef "_values $description $val1 $val2 $val3 $val4..." Theme
Where $description is a short description and $val1 $val2 are the values.
Thanks again.
Regards,
-- Shlomi
--
------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Chuck Norris helps the gods that help themselves.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
Messages sorted by:
Reverse Date,
Date,
Thread,
Author