From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1588 invoked from network); 3 Jun 2020 12:53:46 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 3 Jun 2020 12:53:46 -0000 Received: (qmail 29736 invoked by alias); 3 Jun 2020 12:53:38 -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: List-Unsubscribe: X-Seq: 24899 Received: (qmail 25409 invoked by uid 1010); 3 Jun 2020 12:53:38 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi1-f195.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25828. spamassassin: 3.4.4. Clear:RC:0(209.85.167.195):SA:0(-1.4/5.0):. Processed in 1.525705 secs); 03 Jun 2020 12:53:38 -0000 X-Envelope-From: oniony@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.195 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Zq+oEL6AO9nho12RpQfTn5dWMIfCctHA4pdLaJ79jio=; b=brOoDmUCxGH997Fxl07N1M3oHLfCGta1OhU1OKqgjKW0ZFa/LnlizZGRberJ2y4fXV yg3px+ufEzaszFh8gtV1BQabMbH1WI7TvJuMDm9YWr3Luu2HfXJ7uSKWu3squt92H7zA pvcNieB9+221GH4uM3YVbrV4Soew+6Oc0YHuA7Jm/v/KRoMlDlt/f+wHOfCGv1ThC6N4 FuXZ1jMoEx5vJk5oByfPpJUy6xi0v+2VlW+wEnPCQzaFo+fnPqKW06cUq++giVqXaz+p 4oa/tO0SxvnWzMQjQp+G3aB8WPHqCV+Tn0ooT0lIqlG9qyNpAwPmcgO+3uhhQ/6MTU0W IA2Q== X-Gm-Message-State: AOAM532saQWeAIEKfOstoBEsl22ajtsd56168N4TUHLdkyKKcyDwpecn tIqC42h8DDVw3hv9FqRXGId9eaGyOWK+WCZUkdA= X-Google-Smtp-Source: ABdhPJw0gxS4+0yDT621o8Ia6lsD5xhZNw7LJPFuzaCddZkFqeC4JOPUCUUBrKD+0GUpD/ySjbEjwr/szGV79Fay6+M= X-Received: by 2002:a05:6808:299:: with SMTP id z25mr6139803oic.26.1591188784045; Wed, 03 Jun 2020 05:53:04 -0700 (PDT) MIME-Version: 1.0 References: <20200603005555.304cca04@tarpaulin.shahaf.local2> In-Reply-To: <20200603005555.304cca04@tarpaulin.shahaf.local2> From: Paul Ruane Date: Wed, 3 Jun 2020 13:52:52 +0100 Message-ID: Subject: Re: Cryptsetup completion To: Daniel Shahaf Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 3 Jun 2020 at 01:56, Daniel Shahaf wrote: > The helper functions are in the global namespace so they should have > names that are less likely to clash. Also, they aren't specific to > cryptsetup, so we could break them out to separate, autoloadable files I have renamed these with prefix "_crypto". I noticed commands and types are now split into their respective directories so I have placed them accordingly. > that (you can simply clone the git repository and, for testing, set > =C2=ABfpath=3D( /path/to/zsh/Completions/**/*(/) )=C2=BB prior to running= compinit.). I was unable to get the fpath with the globbing to work. I ended up using "fpath=3D( /home/paul/projects/zsh/Completion )". Even so I had some errors ("_arguments:comparguments:393: too many arguments") completing with many commands, not just cryptsetup, but I assume that this is some incompatibility between my 5.8 and HEAD. I've used a slightly modified version of Mikael's parameter expansion to eliminate the need to fork processes. The new patch--in correct format :)--is here: diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index 45159d0be..3e3bd5ba0 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -8,8 +8,8 @@ _arguments -s \ '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' \ '--debug[show debug messages]' \ '--debug-json[show debug messages including JSON metadata]' \ - '(-c --cipher)'{-c+,--cipher=3D}'[set cipher]:cipher specification' \ - '(-h --hash)'{-h+,--hash=3D}'[hash algorithm]:hash algorithm' \ + '(-c --cipher)'{-c+,--cipher=3D}'[set cipher]:cipher specification:_crypto_ciphers' \ + '(-h --hash)'{-h+,--hash=3D}'[hash algorithm]:hash algorithm:_crypto_has= hes' \ '(-y --verify-passphrase)'{-y,--verify-passphrase}'[query for password twice]' \ '(-d --key-file)'{-d+,--key-file=3D}'[set keyfile]:key file:_files' \ '--master-key-file=3D[set master key]:key file:_files' \ diff --git a/Completion/Linux/Type/_crypto_ciphers b/Completion/Linux/Type/_crypto_ciphers new file mode 100644 index 000000000..ab9138a11 --- /dev/null +++ b/Completion/Linux/Type/_crypto_ciphers @@ -0,0 +1,7 @@ +#autoload + +cipher_list=3D( ${${${(M)${(s:name:)${(M)${(f)"$(