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 31414 invoked from network); 2 Jun 2020 16:18:38 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 2 Jun 2020 16:18:38 -0000 Received: (qmail 24100 invoked by alias); 2 Jun 2020 16:18:23 -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: 24894 Received: (qmail 4428 invoked by uid 1010); 2 Jun 2020 16:18:23 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f41.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.210.41):SA:0(-1.4/5.0):. Processed in 3.021683 secs); 02 Jun 2020 16:18:23 -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.210.41 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:from:date:message-id:subject:to; bh=cao9p6R0pZvJ8Xc9TLN+FEZdAPRpL1Qu+M/qSA3ev24=; b=dX8uMQhK578Hggb4qzDal4rexNQhb5fHdt32vqdvOHW28jnwfyEe40EyaMtDS7Hluy YqHA7yPIU0h2+ThzOvRTjeENWWiDomzdpO69uhGgg8t94qZBlJsJaavpLcINgfgJwc7G LUZWwSt6ivEZMjSW9hGIX8Ag8lQjUYGcM59DbG/D4N1E5QPsfXXCr7EyGLLwyl5d+F50 yjHjz8xnoyPhBVscsbgqIer7KRrt0JNd7yci4zGtDm5zU/nmhF/lhJIVjuw07kd9LdQZ uD93b2y0V8hpUJxUFkq4VHQTaS1l+qBYoCtwXKbnWDdqsOcDxYm1bEeWih90bcMO0qYL wwKg== X-Gm-Message-State: AOAM532rxXX2Uo3HYtzs7ptrKDFHeZfqDhO7QCHO3Ne3wLrq0bWieHCx 9wHdlC5jx7LJCKaebqyECV/qXtnaRH0NNexdogSmStD4 X-Google-Smtp-Source: ABdhPJwEJ2eOMMGnJObMUsNu1N2IH8mxyXx9Ou/ohsf895G83Cf6IHGg4mAEM+fw4+oiEwamDJf7O42tTORd0bKaTiw= X-Received: by 2002:a05:6830:11c3:: with SMTP id v3mr73334otq.314.1591114667263; Tue, 02 Jun 2020 09:17:47 -0700 (PDT) MIME-Version: 1.0 From: Paul Ruane Date: Tue, 2 Jun 2020 17:17:36 +0100 Message-ID: Subject: Cryptsetup completion To: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" Hi, For my own system I have modified the Zsh completion of cryptsetup to include completion of the hash and cipher based upon those declared available in /proc/crypto. I thought this might be useful for other users, too, so I have included my changes below for your consideration. 11,12c11,12 < '(-c --cipher)'{-c+,--cipher=}'[set cipher]:cipher specification' \ < '(-h --hash)'{-h+,--hash=}'[hash algorithm]:hash algorithm' \ --- > '(-c --cipher)'{-c+,--cipher=}'[set cipher]:cipher specification:_ciphers' \ > '(-h --hash)'{-h+,--hash=}'[hash algorithm]:hash algorithm:_hashes' \ 157a158,183 > > _ciphers() { > typeset -a cipher_list > local line > > _call_program grep 'grep "^\(name\|type\)\s\+:" /proc/crypto | grep -B1 "^type\s\+:\s\+cipher" | grep "^name\s\+:" | cut -d ":" -f 2 | uniq | sed "s/^ //"' | \ > while read -A line > do > cipher_list+=($line[1]) > done > > _describe -t ciphers 'cipher' cipher_list "$@" > } > > _hashes() { > typeset -a hash_list > local line > > _call_program grep 'grep "^\(name\|type\)\s\+:" /proc/crypto | grep -B1 "^type\s\+:\s\+shash" | grep "^name\s\+:" | cut -d ":" -f 2 | uniq | sed "s/^ //"' | \ > while read -A line > do > hash_list+=($line[1]) > done > > _describe -t hashes 'hash' hash_list "$@" > } Paul