From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20588 invoked by alias); 9 Apr 2016 13:40:56 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21435 Received: (qmail 18211 invoked from network); 9 Apr 2016 13:40:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=8t52rADiY4LVru6Q2qwenYAxkAKiO8GO0bFEUpIfong=; b=YF621UCQ5XxrE82/Wa2magO56ta4h3IkHg4qfq6fihJoPq6MQIaQB8rPu8ArmM68Dm f0tNwisMdLFg9U4lh23VeZekuLhiGlwrrqGRwELN81D4pA4CQUOdEjKO2GiNDqPOzEWw 4vXDimIdWOwOZ14WmYALlwAjMk6abVKB42HcK3hWl3z78eMJqKSB9Bp7oXWSeJzdpMmg ZYU/rWIc3lY5Fvpp09/n6SX8Ym9fhz5xFSWSZm06uMPr1dOpWjWxbPsd+iNo+v0X/ovb speZaFK7bCJFn5bI6VV6Wjefche4KAglphrFsrbDZehZlQb2ZlxruRvBJQblbIcKxx/B q/pg== X-Gm-Message-State: AD7BkJKY0NjOxPrqDibnbArWqwN+fl+lccJB0EA63gCcjtyAIJiMZiK3Taoh8WoANDc+8MT6QNfFYmNWu4dFQw== MIME-Version: 1.0 X-Received: by 10.112.188.134 with SMTP id ga6mr5435839lbc.77.1460209252922; Sat, 09 Apr 2016 06:40:52 -0700 (PDT) In-Reply-To: <20160409124553.783683a3@pwslap01u.europe.root.pri> References: <20160409124553.783683a3@pwslap01u.europe.root.pri> Date: Sat, 9 Apr 2016 16:40:52 +0300 Message-ID: Subject: Re: The zsh equivalent to Bash's "complete -W" to complete a command using only a list of words From: Shlomi Fish To: Peter Stephenson Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=001a11c37ad2d17e9d05300d75bf --001a11c37ad2d17e9d05300d75bf Content-Type: text/plain; charset=UTF-8 Hi Mr. Stephenson! thanks for your reply. On Sat, Apr 9, 2016 at 2:45 PM, Peter Stephenson wrote: > On Sat, 09 Apr 2016 13:27:39 +0300 > Shlomi Fish 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 . --001a11c37ad2d17e9d05300d75bf--