]> git.notmuchmail.org Git - sup/blob - contrib/completion/_sup.zsh
Merge commit 'origin/string-split-fixes'
[sup] / contrib / completion / _sup.zsh
1 #compdef sup sup-add sup-config sup-dump sup-sync sup-sync-back sup-tweak-labels sup-recover-sources
2 # vim: set et sw=2 sts=2 ts=2 ft=zsh :
3
4 # TODO: sources completion: maildir://some/dir, mbox://some/file, ...
5 #       for sup-add, sup-sync, sup-sync-back, sup-tweak-labels
6
7 (( ${+functions[_sup_cmd]} )) ||
8 _sup_cmd()
9 {
10   _arguments -s : \
11     "(--list-hooks -l)"{--list-hooks,-l}"[list all hooks and descriptions, and quit]" \
12     "(--no-threads -n)"{--no-threads,-n}"[turn off threading]" \
13     "(--no-initial-poll -o)"{--no-initial-poll,-o}"[Don't poll for new messages when starting]" \
14     "(--search -s)"{--search,-s}"[search for this query upon startup]:Query: " \
15     "(--compose -c)"{--compose,-c}"[compose message to this recipient upon startup]:Email: " \
16     "--version[show version information]" \
17     "(--help -h)"{--help,-h}"[show help]"
18 }
19
20 (( ${+functions[_sup_add_cmd]} )) ||
21 _sup_add_cmd()
22 {
23   _arguments -s : \
24     "(--archive -a)"{--archive,-a}"[automatically archive all new messages from this source]" \
25     "(--unusual -u)"{--unusual,-u}"[do not automatically poll for new messages from this source]" \
26     "(--labels -l)"{--labels,-l}"[set of labels to apply to all messages from this source]:Labels: " \
27     "(--force-new -f)"{--force-new,-f}"[create a new account for this source, even if one already exists]" \
28     "--version[show version information]" \
29     "(--help -h)"{--help,-h}"[show help]"
30 }
31
32 (( ${+functions[_sup_config_cmd]} )) ||
33 _sup_config_cmd()
34 {
35   _arguments -s : \
36     "--version[show version information]" \
37     "(--help -h)"{--help,-h}"[show help]"
38 }
39
40 (( ${+functions[_sup_dump_cmd]} )) ||
41 _sup_dump_cmd()
42 {
43   _arguments -s : \
44     "--version[show version information]" \
45     "(--help -h)"{--help,-h}"[show help]"
46 }
47
48 (( ${+functions[_sup_recover_sources_cmd]} )) ||
49 _sup_recover_sources_cmd()
50 {
51   _arguments -s : \
52     "--archive[automatically archive all new messages from this source]" \
53     "--scan-num[number of messages to scan per source]:" \
54     "--unusual[do not automatically poll for new messages from this source]" \
55     "(--help -h)"{--help,-h}"[show help]"
56 }
57
58 (( ${+functions[_sup_sync_cmd]} )) ||
59 _sup_sync_cmd()
60 {
61   # XXX Add only when --restore is given: (--restored -r)
62   #     Add only when --changed or--all are given: (--start-at -s)
63   _arguments -s : \
64     "--new[operate on new messages only]" \
65     "(--changed -c)"{--changed,-c}"[scan over the entire source for messages that have been deleted, altered, or moved from another source]" \
66     "(--restored -r)"{--restored,-r}"[operate only on those messages included in a dump file as specified by --restore which have changed state]" \
67     "(--all -a)"{--all,-a}"[operate on all messages in the source, regardless of newness or changedness]" \
68     "(--start-at -s)"{--start-at,-s}"[start at a particular offset]:Offset: " \
69     "--asis[if the message is already in the index, preserve its state, otherwise, use default source state]" \
70     "--restore[restore message state from a dump file created with sup-dump]:File:_file" \
71     "--discard[discard any message state in the index and use the default source state]" \
72     "(--archive -x)"{--archive,-x}"[mark messages as archived when using the default source state]" \
73     "(--read -e)"{--read,-e}"[mark messages as read when using the default source state]" \
74     "--extra-labels[apply these labels when using the default source state]:Labels: " \
75     "(--verbose -v)"{--verbose,-v}"[print message ids as they're processed]" \
76     "(--optimize -o)"{--optimize,-o}"[as the final operation, optimize the index]" \
77     "--all-sources[scan over all sources]" \
78     "(--dry-run -n)"{--dry-run,-n}"[don't actually modify the index]" \
79     "--version[show version information]" \
80     "(--help -h)"{--help,-h}"[show help]"
81 }
82
83 (( ${+functions[_sup_sync_back_cmd]} )) ||
84 _sup_sync_back_cmd()
85 {
86   _arguments -s : \
87     "(--drop-deleted -d)"{--drop-deleted,-d}"[drop deleted messages]" \
88     "--move-deleted[move deleted messages to a local mbox file]:File:_file" \
89     "(--drop-spam -s)"{--drop-spam,-s}"[drop spam messages]" \
90     "--move-spam[move spam messages to a local mbox file]:File:_file" \
91     "--with-dotlockfile[specific dotlockfile location (mbox files only)]:File:_file" \
92     "--dont-use-dotlockfile[don't use dotlockfile to lock mbox files]" \
93     "(--verbose -v)"{--verbose,-v}"[print message ids as they're processed]" \
94     "(--dry-run -n)"{--dry-run,-n}"[don't actually modify the index]" \
95     "--version[show version information]" \
96     "(--help -h)"{--help,-h}"[show help]"
97 }
98
99 (( ${+functions[_sup_tweak_labels_cmd]} )) ||
100 _sup_tweak_labels_cmd()
101 {
102   _arguments -s : \
103     "(--add -a)"{--add,-a}"[which labels to add to every message from the specified sources]:Labels: " \
104     "(--remove -r)"{--remove,-r}"[which labels to remove from every message from the specified sources]:Labels: " \
105     "--all-sources[scan over all sources]" \
106     "(--verbose -v)"{--verbose,-v}"[print message ids as they're processed]" \
107     "(--dry-run -n)"{--dry-run,-n}"[don't actually modify the index]" \
108     "--version[show version information]" \
109     "(--help -h)"{--help,-h}"[show help]"
110 }
111
112 _call_function ret _${words[1]//-/_}_cmd
113 return ret
114