* minor change to mu-completion.zsh

This commit is contained in:
djcb 2012-04-30 08:17:43 +03:00
parent f007bb369b
commit ecee4831ef
1 changed files with 91 additions and 81 deletions

View File

@ -1,6 +1,6 @@
#compdef mu
## Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
## Copyright (C) 2011-2012 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@ -16,18 +16,39 @@
## along with this program; if not, write to the Free Software Foundation,
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# zsh completion for mu.
# zsh completion for mu. Install this by copying/linking to this file somewhere in
# your $fpath; the link/copy must have a name starting with an underscore "_"
# main dispatcher function
_mu() {
if (( CURRENT > 2 )) ; then
local cmd=${words[2]}
curcontext="${curcontext%:*:*}:mu-$cmd"
(( CURRENT-- ))
shift words
_call_function ret _mu_$cmd
return ret
else
_mu_commands
fi
}
_mu_commands() {
local -a mu_commands
mu_commands=(
'index:scan your maildirs and import their metadata in the database'
'find:search for messages in the database'
'view:display specific messages'
'cfind:search for contacts (name + email) in the database'
'cleanup:remove deleted messages from the database'
'extract:list message-parts (attachments) and extract them to files'
'extract:extract message-parts (attachments) and save or open them'
'mkdir:create maildirs'
'view:display specific messages')
# below are not generally very useful, so let's not auto-complete them
# 'add: add a message to the database.'
# 'remove:remove a message from the database.'
# 'server:sart the mu server'
)
_describe -t command 'command' mu_commands
}
@ -35,7 +56,7 @@ _mu_commands() {
_mu_common_options=(
'--debug[output information useful for debugging mu]'
'--quiet[do not give any non-critical information]'
'--color[use colors in some of the output]'
'--nocolor[do not use colors in some of the output]'
'--version[display mu version and copyright information]'
'--log-stderr[log to standard error]'
)
@ -49,12 +70,14 @@ _mu_find_options=(
'--sortfield[field to sort the output by]'
'--descending[sort in descending order]'
'--summary[include a summary of the message]'
'--summary-len[number of lines to use for the summary]'
'--bookmark[use a named bookmark]'
'--output[set the kind of output for the query]'
)
_mu_view_options=(
'--summary[only show a summary of the message]'
'--summary-len[number of lines to use for the summary]'
)
@ -79,12 +102,12 @@ _mu_index() {
_arguments -s : \
$_mu_db_options \
$_mu_common_options
}
}mu
_mu_cleanup() {
_arguments -s : \
$_mu_db_options \
$_mu_common_options
$_mu_common_options
}
@ -94,19 +117,6 @@ _mu_mkdir() {
$_mu_common_options
}
_mu() {
if (( CURRENT > 2 )) ; then
local cmd=${words[2]}
curcontext="${curcontext%:*:*}:mu-$cmd"
(( CURRENT-- ))
shift words
_call_function ret _mu_$cmd
return ret
else
_mu_commands
fi
}
_mu "$@"
# Local variables: