* [PATCH] Add completions for cryptsetup and twidge
@ 2011-08-16 18:39 Daniel Friesel
2011-08-16 19:18 ` Mikael Magnusson
2011-08-16 19:39 ` Daniel Friesel
0 siblings, 2 replies; 6+ messages in thread
From: Daniel Friesel @ 2011-08-16 18:39 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1.1: Type: text/plain, Size: 79 bytes --]
Hi,
could someone merge these into the repo, if they're okay?
Thanks,
Daniel
[-- Attachment #1.2: 0001-Add-completions-for-cryptsetup-and-twidge.patch --]
[-- Type: text/x-diff, Size: 6304 bytes --]
From cad35431d9427b326f9d6ecdfe58ef1f50de4f0b Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Tue, 16 Aug 2011 20:16:52 +0200
Subject: [PATCH] Add completions for cryptsetup and twidge
---
Completion/Linux/Command/_cryptsetup | 99 ++++++++++++++++++++++++++++++++++
Completion/Unix/Command/_twidge | 77 ++++++++++++++++++++++++++
2 files changed, 176 insertions(+), 0 deletions(-)
create mode 100644 Completion/Linux/Command/_cryptsetup
create mode 100644 Completion/Unix/Command/_twidge
diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup
new file mode 100644
index 0000000..3256d7c
--- /dev/null
+++ b/Completion/Linux/Command/_cryptsetup
@@ -0,0 +1,99 @@
+#compdef cryptsetup
+## completion for cryptsetup 1.3.0, based on cryptsetup(1)
+
+function _cryptsetup_action {
+ typeset -a actions
+ actions=(
+ 'create:create a mapping'
+ 'remove:remove an existing mapping'
+ 'status:report mapping status'
+ 'resize:resize an active mapping'
+ 'luksFormat:Initialize a LUKS partition'
+ 'luksOpen:Open LUKS partition'
+ 'luksClose:remove an existing mapping'
+ 'luksSuspend:suspend active device'
+ 'luksResume:resume suspended device'
+ 'luksAddKey:add a new key'
+ 'luksRemoveKey:remove a key'
+ 'luksChangeKey:change a key'
+ 'luksKillSlot:wipe key from slot'
+ 'luksUUID:print/change device UUID'
+ 'isLuks:check if device is a LUKS partition'
+ 'luksDump:dump header information'
+ 'luksHeaderBackup:store binary backup of headers'
+ 'luksHeaderRestore:restore header backup'
+ )
+ _describe action actions
+}
+
+function _cryptsetup_device {
+ typeset expl
+ _wanted file expl device \
+ _files
+}
+
+function _cryptsetup_mapping {
+ typeset expl
+ _wanted file expl 'mapping name' \
+ _path_files -W /dev/mapper
+}
+
+function _cryptsetup_arguments {
+
+ case ${words[1]} in
+
+ create)
+ _arguments ':mapping:_cryptsetup_mapping' ':device:_cryptsetup_device'
+ ;;
+
+ remove|status|resize|luksClose|luksSuspend|luksResume)
+ _arguments ': :_cryptsetup_mapping'
+ ;;
+
+ luks(AddKey|RemoveKey|DelKey|UUID|Dump)|isLuks)
+ _arguments ': :_cryptsetup_device'
+ ;;
+
+ luks(Format|AddKey|RemoveKey|ChangeKey))
+ _arguments ': :_cryptsetup_device' ':key file:_files'
+ ;;
+
+ luksKillSlot)
+ _arguments ': :_cryptsetup_device' ':key slot number'
+ ;;
+
+ luksOpen)
+ _arguments ': :_cryptsetup_device' ': :_cryptsetup_mapping'
+ ;;
+
+ esac
+}
+
+_arguments \
+ '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' \
+ '--debug[enable debug mode]' \
+ '(-h --hash)'{-h,--hash}'[hash algorithm]:hash algorithm' \
+ '(-c --cipher)'{-c,--cipher}'[set cipher]:cipher specification' \
+ '(-y --verify-passphrase)'{-y,--verify-passphrase}'[query for password twice]' \
+ '(-d --key-file)'{-d,--key-file}'[set keyfile]:key file:_files' \
+ '(-l --keyfile-size)'{-l,--keyfile-size}'[set keyfile size]:bytes' \
+ '--new-keyfile-size[set new keyfile size (luksAddKey)]:bytes' \
+ '--master-key-file[set master key]:key file:_files' \
+ '--dump-master-key[dump luks master key]' \
+ '(--use-urandom)--use-random[use /dev/random to generate volume key]' \
+ '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \
+ '(-S --key-slot)'{-S,--key-slot}'[select key slot]:key slot' \
+ '(-s --key-size)'{-s,--key-size}'[set key size]:bits' \
+ '(-b --size)'{-b,--size}'[force device size]:sectors' \
+ '(-o --offset)'{-o,--offset}'[set start offset]:sectors' \
+ '(-p --skip)'{-p,--skip}'[data to skip at beginning]:sectors' \
+ '--readonly[set up read-only mapping]' \
+ '(-i --iter-time)'{-i,--iter-time}'[set password processing duration]:milliseconds' \
+ '(-q --batch-mode)'{-q,--batch-mode}'[do not ask for confirmation]' \
+ '(-t --timeout)'{-t,--timeout}'[set password prompt timeout]:seconds' \
+ '(-T --tries)'{-T,--tries}'[set maximum number of retries]:maximum retries' \
+ '--align-payload[set payload alignment]:sectors' \
+ '--uuid[set device UUID]:uuid' \
+ '--version[show version information]' \
+ ':action:_cryptsetup_action' \
+ '*::arguments:_cryptsetup_arguments'
diff --git a/Completion/Unix/Command/_twidge b/Completion/Unix/Command/_twidge
new file mode 100644
index 0000000..45993b2
--- /dev/null
+++ b/Completion/Unix/Command/_twidge
@@ -0,0 +1,77 @@
+#compdef twidge
+## completion for twidge 1.0.8, based on twidge(1)
+
+function _twidge_command {
+ typeset -a twidge_commands
+ typeset -i skip=1
+
+ twidge lscommands | while read cmd desc; do
+ if [[ $cmd == ---* ]] {
+ skip=0
+ continue
+ }
+ if (( skip )) {
+ continue
+ }
+ twidge_commands+="${cmd}:${desc}"
+ done
+
+ _describe command twidge_commands
+}
+
+function _twidge_args {
+ typeset -a args_common args_more args_other args_update
+
+ args_common=(
+ '(-a --all)'{-a,--all}'[receive all content]'
+ '(-e --exec)'{-e,--exec}'[execute command for each retrieved item]:command'
+ '(-l --long)'{-l,--long}'[long output format]'
+ '(-m --mailto)'{-m,--mailto}'[mail retrieved items]:mail address'
+ )
+
+ args_more=(
+ '(-s --saveid)'{-s,--saveid}'[save ID of most recent message]'
+ '(-u --unseen)'{-u,--unseen}'[only show unseen messages]'
+ )
+
+ args_other=(
+ '(-U --username)'{-U,--username}'[show updates of different user]:username'
+ )
+
+ args_update=(
+ '(-i --inreplyto)'{-i,--inreplyto}'[update in reply to a message]:message id'
+ '(-i --inreplyto 1)-r[read RFC2822 Mail]'
+ ':status'
+ )
+
+ case ${words[1]} in
+ lsarchive)
+ _arguments $args_common $args_more $args_other
+ ;;
+ ls(dm(|archive)|recent|replies|rt(|archive|replies)))
+ _arguments $args_common $args_more
+ ;;
+ lsfollow(ers|ing))
+ _arguments $args_common :username
+ ;;
+ dmsend)
+ _arguments :recipient :status
+ ;;
+ (un|)follow)
+ _message username
+ ;;
+ update)
+ _arguments $args_update
+ ;;
+ esac
+}
+
+function _twidge {
+ _arguments \
+ '(-c --config)'{-c,--config}'[config file]:file:_files' \
+ '(-d --debug)'{-d,--debug}'[enable debugging output]' \
+ '(-): :_twidge_command' \
+ '(-)*:: :_twidge_args'
+}
+
+_twidge
--
1.7.5.4
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add completions for cryptsetup and twidge
2011-08-16 18:39 [PATCH] Add completions for cryptsetup and twidge Daniel Friesel
@ 2011-08-16 19:18 ` Mikael Magnusson
2011-08-16 19:39 ` Daniel Friesel
1 sibling, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2011-08-16 19:18 UTC (permalink / raw)
To: Daniel Friesel; +Cc: zsh-workers
On 16 August 2011 20:39, Daniel Friesel <derf@finalrewind.org> wrote:
> Hi,
>
> could someone merge these into the repo, if they're okay?
In _cryptsetup you don't redefine _cryptsetup() like you do in _twidge
(it's better to redefine it to avoid redefining all the helper
functions every time), and in _twidge you forget to pass "$@".
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add completions for cryptsetup and twidge
2011-08-16 18:39 [PATCH] Add completions for cryptsetup and twidge Daniel Friesel
2011-08-16 19:18 ` Mikael Magnusson
@ 2011-08-16 19:39 ` Daniel Friesel
2011-08-16 19:44 ` Mikael Magnusson
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Friesel @ 2011-08-16 19:39 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1.1: Type: text/plain, Size: 62 bytes --]
Updated patch (redefine _cryptsetup, pass on "$@" in _twidge)
[-- Attachment #1.2: 0001-Add-completions-for-cryptsetup-and-twidge.patch --]
[-- Type: text/x-diff, Size: 6357 bytes --]
From ccf9776a095d663cd8c642dc163e546ed2da2c62 Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Tue, 16 Aug 2011 20:16:52 +0200
Subject: [PATCH] Add completions for cryptsetup and twidge
---
Completion/Linux/Command/_cryptsetup | 103 ++++++++++++++++++++++++++++++++++
Completion/Unix/Command/_twidge | 77 +++++++++++++++++++++++++
2 files changed, 180 insertions(+), 0 deletions(-)
create mode 100644 Completion/Linux/Command/_cryptsetup
create mode 100644 Completion/Unix/Command/_twidge
diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup
new file mode 100644
index 0000000..3519336
--- /dev/null
+++ b/Completion/Linux/Command/_cryptsetup
@@ -0,0 +1,103 @@
+#compdef cryptsetup
+## completion for cryptsetup 1.3.0, based on cryptsetup(1)
+
+function _cryptsetup_action {
+ typeset -a actions
+ actions=(
+ 'create:create a mapping'
+ 'remove:remove an existing mapping'
+ 'status:report mapping status'
+ 'resize:resize an active mapping'
+ 'luksFormat:Initialize a LUKS partition'
+ 'luksOpen:Open LUKS partition'
+ 'luksClose:remove an existing mapping'
+ 'luksSuspend:suspend active device'
+ 'luksResume:resume suspended device'
+ 'luksAddKey:add a new key'
+ 'luksRemoveKey:remove a key'
+ 'luksChangeKey:change a key'
+ 'luksKillSlot:wipe key from slot'
+ 'luksUUID:print/change device UUID'
+ 'isLuks:check if device is a LUKS partition'
+ 'luksDump:dump header information'
+ 'luksHeaderBackup:store binary backup of headers'
+ 'luksHeaderRestore:restore header backup'
+ )
+ _describe action actions
+}
+
+function _cryptsetup_device {
+ typeset expl
+ _wanted file expl device \
+ _files
+}
+
+function _cryptsetup_mapping {
+ typeset expl
+ _wanted file expl 'mapping name' \
+ _path_files -W /dev/mapper
+}
+
+function _cryptsetup_arguments {
+
+ case ${words[1]} in
+
+ create)
+ _arguments ':mapping:_cryptsetup_mapping' ':device:_cryptsetup_device'
+ ;;
+
+ remove|status|resize|luksClose|luksSuspend|luksResume)
+ _arguments ': :_cryptsetup_mapping'
+ ;;
+
+ luks(AddKey|RemoveKey|DelKey|UUID|Dump)|isLuks)
+ _arguments ': :_cryptsetup_device'
+ ;;
+
+ luks(Format|AddKey|RemoveKey|ChangeKey))
+ _arguments ': :_cryptsetup_device' ':key file:_files'
+ ;;
+
+ luksKillSlot)
+ _arguments ': :_cryptsetup_device' ':key slot number'
+ ;;
+
+ luksOpen)
+ _arguments ': :_cryptsetup_device' ': :_cryptsetup_mapping'
+ ;;
+
+ esac
+}
+
+function _cryptsetup {
+ _arguments \
+ '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' \
+ '--debug[enable debug mode]' \
+ '(-h --hash)'{-h,--hash}'[hash algorithm]:hash algorithm' \
+ '(-c --cipher)'{-c,--cipher}'[set cipher]:cipher specification' \
+ '(-y --verify-passphrase)'{-y,--verify-passphrase}'[query for password twice]' \
+ '(-d --key-file)'{-d,--key-file}'[set keyfile]:key file:_files' \
+ '(-l --keyfile-size)'{-l,--keyfile-size}'[set keyfile size]:bytes' \
+ '--new-keyfile-size[set new keyfile size (luksAddKey)]:bytes' \
+ '--master-key-file[set master key]:key file:_files' \
+ '--dump-master-key[dump luks master key]' \
+ '(--use-urandom)--use-random[use /dev/random to generate volume key]' \
+ '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \
+ '(-S --key-slot)'{-S,--key-slot}'[select key slot]:key slot' \
+ '(-s --key-size)'{-s,--key-size}'[set key size]:bits' \
+ '(-b --size)'{-b,--size}'[force device size]:sectors' \
+ '(-o --offset)'{-o,--offset}'[set start offset]:sectors' \
+ '(-p --skip)'{-p,--skip}'[data to skip at beginning]:sectors' \
+ '--readonly[set up read-only mapping]' \
+ '(-i --iter-time)'{-i,--iter-time}'[set password processing duration]:milliseconds' \
+ '(-q --batch-mode)'{-q,--batch-mode}'[do not ask for confirmation]' \
+ '(-t --timeout)'{-t,--timeout}'[set password prompt timeout]:seconds' \
+ '(-T --tries)'{-T,--tries}'[set maximum number of retries]:maximum retries' \
+ '--align-payload[set payload alignment]:sectors' \
+ '--uuid[set device UUID]:uuid' \
+ '--version[show version information]' \
+ ':action:_cryptsetup_action' \
+ '*::arguments:_cryptsetup_arguments'
+}
+
+_cryptsetup "$@"
diff --git a/Completion/Unix/Command/_twidge b/Completion/Unix/Command/_twidge
new file mode 100644
index 0000000..d8b3b3d
--- /dev/null
+++ b/Completion/Unix/Command/_twidge
@@ -0,0 +1,77 @@
+#compdef twidge
+## completion for twidge 1.0.8, based on twidge(1)
+
+function _twidge_command {
+ typeset -a twidge_commands
+ typeset -i skip=1
+
+ twidge lscommands | while read cmd desc; do
+ if [[ $cmd == ---* ]] {
+ skip=0
+ continue
+ }
+ if (( skip )) {
+ continue
+ }
+ twidge_commands+="${cmd}:${desc}"
+ done
+
+ _describe command twidge_commands
+}
+
+function _twidge_args {
+ typeset -a args_common args_more args_other args_update
+
+ args_common=(
+ '(-a --all)'{-a,--all}'[receive all content]'
+ '(-e --exec)'{-e,--exec}'[execute command for each retrieved item]:command'
+ '(-l --long)'{-l,--long}'[long output format]'
+ '(-m --mailto)'{-m,--mailto}'[mail retrieved items]:mail address'
+ )
+
+ args_more=(
+ '(-s --saveid)'{-s,--saveid}'[save ID of most recent message]'
+ '(-u --unseen)'{-u,--unseen}'[only show unseen messages]'
+ )
+
+ args_other=(
+ '(-U --username)'{-U,--username}'[show updates of different user]:username'
+ )
+
+ args_update=(
+ '(-i --inreplyto)'{-i,--inreplyto}'[update in reply to a message]:message id'
+ '(-i --inreplyto 1)-r[read RFC2822 Mail]'
+ ':status'
+ )
+
+ case ${words[1]} in
+ lsarchive)
+ _arguments $args_common $args_more $args_other
+ ;;
+ ls(dm(|archive)|recent|replies|rt(|archive|replies)))
+ _arguments $args_common $args_more
+ ;;
+ lsfollow(ers|ing))
+ _arguments $args_common :username
+ ;;
+ dmsend)
+ _arguments :recipient :status
+ ;;
+ (un|)follow)
+ _message username
+ ;;
+ update)
+ _arguments $args_update
+ ;;
+ esac
+}
+
+function _twidge {
+ _arguments \
+ '(-c --config)'{-c,--config}'[config file]:file:_files' \
+ '(-d --debug)'{-d,--debug}'[enable debugging output]' \
+ '(-): :_twidge_command' \
+ '(-)*:: :_twidge_args'
+}
+
+_twidge "$@"
--
1.7.5.4
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add completions for cryptsetup and twidge
2011-08-16 19:39 ` Daniel Friesel
@ 2011-08-16 19:44 ` Mikael Magnusson
2011-08-17 10:25 ` Mikael Magnusson
0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2011-08-16 19:44 UTC (permalink / raw)
To: Daniel Friesel; +Cc: zsh-workers
On 16 August 2011 21:39, Daniel Friesel <derf@finalrewind.org> wrote:
> Updated patch (redefine _cryptsetup, pass on "$@" in _twidge)
Thanks, I'll commit it if nobody else has any complaints. :)
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add completions for cryptsetup and twidge
2011-08-16 19:44 ` Mikael Magnusson
@ 2011-08-17 10:25 ` Mikael Magnusson
2011-08-17 10:30 ` Daniel Friesel
0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2011-08-17 10:25 UTC (permalink / raw)
To: Daniel Friesel; +Cc: zsh-workers
On 16 August 2011 21:44, Mikael Magnusson <mikachu@gmail.com> wrote:
> On 16 August 2011 21:39, Daniel Friesel <derf@finalrewind.org> wrote:
>> Updated patch (redefine _cryptsetup, pass on "$@" in _twidge)
>
> Thanks, I'll commit it if nobody else has any complaints. :)
Oh, and you also need to list any new completers in .distfiles in the
respective directories. (I've done this already for these files, so no
need to resend this patch.)
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Add completions for cryptsetup and twidge
2011-08-17 10:25 ` Mikael Magnusson
@ 2011-08-17 10:30 ` Daniel Friesel
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Friesel @ 2011-08-17 10:30 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 610 bytes --]
On Wed, Aug 17, 2011 at 12:25:51PM +0200, Mikael Magnusson wrote:
> On 16 August 2011 21:44, Mikael Magnusson <mikachu@gmail.com> wrote:
> > On 16 August 2011 21:39, Daniel Friesel <derf@finalrewind.org> wrote:
> >> Updated patch (redefine _cryptsetup, pass on "$@" in _twidge)
> >
> > Thanks, I'll commit it if nobody else has any complaints. :)
>
> Oh, and you also need to list any new completers in .distfiles in the
> respective directories. (I've done this already for these files, so no
> need to resend this patch.)
Okay, I'll keep that in mind for future patches. Thanks! :)
--Daniel
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-17 10:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-16 18:39 [PATCH] Add completions for cryptsetup and twidge Daniel Friesel
2011-08-16 19:18 ` Mikael Magnusson
2011-08-16 19:39 ` Daniel Friesel
2011-08-16 19:44 ` Mikael Magnusson
2011-08-17 10:25 ` Mikael Magnusson
2011-08-17 10:30 ` Daniel Friesel
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).