11# compdef mu
22
3- # # Copyright (C) 2008- 2011 Dirk-Jan C. Binnema <[email protected] >3+ # # Copyright (C) 2011-2012 Dirk-Jan C. Binnema <[email protected] >44# #
55# # This program is free software; you can redistribute it and/or modify
66# # it under the terms of the GNU General Public License as published by
77# # the Free Software Foundation; either version 3 of the License, or
88# # (at your option) any later version.
9- # #
9+ # #
1010# # This program is distributed in the hope that it will be useful,
1111# # but WITHOUT ANY WARRANTY; without even the implied warranty of
1212# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313# # GNU General Public License for more details.
14- # #
14+ # #
1515# # You should have received a copy of the GNU General Public License
1616# # along with this program; if not, write to the Free Software Foundation,
17- # # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17+ # # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
19+ # zsh completion for mu. Install this by copying/linking to this file somewhere in
20+ # your $fpath; the link/copy must have a name starting with an underscore "_"
21+
22+ # main dispatcher function
23+ _mu () {
24+ if (( CURRENT > 2 )) ; then
25+ local cmd=${words[2]}
26+ curcontext=" ${curcontext%:*:* } :mu-$cmd "
27+ (( CURRENT-- ))
28+ shift words
29+ _call_function ret _mu_$cmd
30+ return ret
31+ else
32+ _mu_commands
33+ fi
34+ }
35+
1836
19- # zsh completion for mu.
2037
2138_mu_commands () {
2239 local -a mu_commands
2340 mu_commands=(
2441 ' index:scan your maildirs and import their metadata in the database'
2542 ' find:search for messages in the database'
43+ ' view:display specific messages'
2644 ' cfind:search for contacts (name + email) in the database'
27- ' cleanup:remove deleted messages from the database'
28- ' extract:list message-parts (attachments) and extract them to files'
45+ ' extract:extract message-parts (attachments) and save or open them'
2946 ' mkdir:create maildirs'
30- ' view:display specific messages' )
47+ # below are not generally very useful, so let's not auto-complete them
48+ # 'add: add a message to the database.'
49+ # 'remove:remove a message from the database.'
50+ # 'server:sart the mu server'
51+ )
3152
3253 _describe -t command ' command' mu_commands
3354}
3455
3556_mu_common_options=(
3657 ' --debug[output information useful for debugging mu]'
3758 ' --quiet[do not give any non-critical information]'
38- ' --color[ use colors in some of the output]'
59+ ' --nocolor[do not use colors in some of the output]'
3960 ' --version[display mu version and copyright information]'
4061 ' --log-stderr[log to standard error]'
4162)
@@ -49,12 +70,14 @@ _mu_find_options=(
4970 ' --sortfield[field to sort the output by]'
5071 ' --descending[sort in descending order]'
5172 ' --summary[include a summary of the message]'
73+ ' --summary-len[number of lines to use for the summary]'
5274 ' --bookmark[use a named bookmark]'
5375 ' --output[set the kind of output for the query]'
5476)
5577
5678_mu_view_options=(
5779 ' --summary[only show a summary of the message]'
80+ ' --summary-len[number of lines to use for the summary]'
5881)
5982
6083
@@ -65,7 +88,7 @@ _mu_view() {
6588}
6689
6790_mu_extract () {
68- _files
91+ _files
6992}
7093
7194_mu_find () {
@@ -79,12 +102,12 @@ _mu_index() {
79102 _arguments -s : \
80103 $_mu_db_options \
81104 $_mu_common_options
82- }
105+ }mu
83106
84107_mu_cleanup () {
85108 _arguments -s : \
86109 $_mu_db_options \
87- $_mu_common_options
110+ $_mu_common_options
88111}
89112
90113
@@ -94,19 +117,6 @@ _mu_mkdir() {
94117 $_mu_common_options
95118}
96119
97- _mu () {
98- if (( CURRENT > 2 )) ; then
99- local cmd=${words[2]}
100- curcontext=" ${curcontext%:*:* } :mu-$cmd "
101- (( CURRENT-- ))
102- shift words
103- _call_function ret _mu_$cmd
104- return ret
105- else
106- _mu_commands
107- fi
108- }
109-
110120_mu " $@ "
111121
112122# Local variables:
0 commit comments