summaryrefslogtreecommitdiffstats
path: root/completion
diff options
context:
space:
mode:
authorMichal Sojka <sojkam1@fel.cvut.cz>2014-11-05 01:25:55 +0100
committerDavid Bremner <david@tethera.net>2014-11-05 23:19:12 +0100
commit5c27136e64dab2f90995de0bfa37c54186a2fae1 (patch)
treeef2c628927a1498a5a7c0954985edc4fcaf5ad31 /completion
parent4387112de00d27e6957ca2b6a268242f0bb5c756 (diff)
cli: Introduce "notmuch address" command
This moves address-related functionality from search command to the new address command. The implementation shares almost all code and some command line options. Options --offset and --limit were intentionally not included in the address command, because they refer to messages numbers, which users do not see in the output. This could confuse users because, for example, they could see more addresses in the output that what was specified with --limit. This functionality can be correctly reimplemented for address subcommand later. Also useless values of --exclude flag were not included in the address command. This was inspired by a patch from Jani Nikula.
Diffstat (limited to 'completion')
-rw-r--r--completion/notmuch-completion.bash42
-rw-r--r--completion/notmuch-completion.zsh10
2 files changed, 49 insertions, 3 deletions
diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index cfbd3890..94ea2d56 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -294,7 +294,7 @@ _notmuch_search()
return
;;
--output)
- COMPREPLY=( $( compgen -W "summary threads messages files tags sender recipients" -- "${cur}" ) )
+ COMPREPLY=( $( compgen -W "summary threads messages files tags" -- "${cur}" ) )
return
;;
--sort)
@@ -320,6 +320,44 @@ _notmuch_search()
esac
}
+_notmuch_address()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ $split &&
+ case "${prev}" in
+ --format)
+ COMPREPLY=( $( compgen -W "json sexp text text0" -- "${cur}" ) )
+ return
+ ;;
+ --output)
+ COMPREPLY=( $( compgen -W "sender recipients" -- "${cur}" ) )
+ return
+ ;;
+ --sort)
+ COMPREPLY=( $( compgen -W "newest-first oldest-first" -- "${cur}" ) )
+ return
+ ;;
+ --exclude)
+ COMPREPLY=( $( compgen -W "true false flag all" -- "${cur}" ) )
+ return
+ ;;
+ esac
+
+ ! $split &&
+ case "${cur}" in
+ -*)
+ local options="--format= --output= --sort= --exclude="
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )
+ ;;
+ *)
+ _notmuch_search_terms
+ ;;
+ esac
+}
+
_notmuch_show()
{
local cur prev words cword split
@@ -393,7 +431,7 @@ _notmuch_tag()
_notmuch()
{
- local _notmuch_commands="compact config count dump help insert new reply restore search setup show tag"
+ local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag"
local arg cur prev words cword split
# require bash-completion with _init_completion
diff --git a/completion/notmuch-completion.zsh b/completion/notmuch-completion.zsh
index 3e52a004..c606b751 100644
--- a/completion/notmuch-completion.zsh
+++ b/completion/notmuch-completion.zsh
@@ -10,6 +10,7 @@ _notmuch_commands()
'setup:interactively set up notmuch for first use'
'new:find and import any new message to the database'
'search:search for messages matching the search terms, display matching threads as results'
+ 'address:get addresses from messages matching the given search terms'
'reply:constructs a reply template for a set of messages'
'show:show all messages matching the search terms'
'tag:add or remove tags for all messages matching the search terms'
@@ -53,7 +54,14 @@ _notmuch_search()
'--max-threads=[display only the first x threads from the search results]:number of threads to show: ' \
'--first=[omit the first x threads from the search results]:number of threads to omit: ' \
'--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \
- '--output=[select what to output]:output:((summary threads messages files tags sender recipients))'
+ '--output=[select what to output]:output:((summary threads messages files tags))'
+}
+
+_notmuch_address()
+{
+ _arguments -s : \
+ '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \
+ '--output=[select what to output]:output:((sender recipients))'
}
_notmuch()