On Tue, Nov 04 2014, David Bremner wrote: > Michal Sojka <sojkam1@fel.cvut.cz> writes: > >> +{ >> + 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 >> +} >> + > > I am reminded that we have no tests for shell completion stuff, which > seems pretty fragile. > >> + >> + ``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**) >> + Presents the results in either JSON, S-Expressions, newline >> + character separated plain-text (default), or null character >> + separated plain-text (compatible with **xargs(1)** -0 option >> + where available). >> + >> + ``--format-version=N`` >> + Use the specified structured output format version. This is >> + intended for programs that invoke **notmuch(1)** internally. If >> + omitted, the latest supported version will be used. >> + > > > I wonder if at some point we should have a notmuch-output-formats.7 page. > > >> + ``--exclude=(true|false|all|flag)`` >> + A message is called "excluded" if it matches at least one tag in >> + search.tag\_exclude that does not appear explicitly in the >> + search terms. This option specifies whether to omit excluded >> + messages in the search process. > > Similarly for excludes. I'm ok with the duplication for now, and I can > see an argument for not making the user chase references. What about using RST include directive [1] to include shared parts into more documents? [1] http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment -Michal