aboutsummaryrefslogtreecommitdiff
path: root/completion/notmuch-completion.bash
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/notmuch-completion.bash
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/notmuch-completion.bash')
-rw-r--r--completion/notmuch-completion.bash42
1 files changed, 40 insertions, 2 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