zsh-workers
 help / color / mirror / code / Atom feed
From: Carl Worth <cworth@cworth.org>
To: zsh-workers@zsh.org
Cc: Clint Adams <schizo@debian.org>, Ingmar Vanhassel <ingmar@exherbo.org>
Subject: Completion script for notmuch
Date: Mon, 24 Jan 2011 09:02:38 +1000	[thread overview]
Message-ID: <87d3nnql4h.fsf@yoom.home.cworth.org> (raw)

[-- Attachment #1: notmuch-completion.zsh --]
[-- Type: application/octet-stream, Size: 1804 bytes --]

#compdef notmuch

# ZSH completion for `notmuch`
# Copyright © 2009 Ingmar Vanhassel <ingmar@exherbo.org>

_notmuch_commands()
{
  local -a notmuch_commands
  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'
    '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'
    'dump:creates a plain-text dump of the tags of each message'
    'restore:restores the tags from the given file'
    'help:show details on a command'
  )

  _describe -t command 'command' notmuch_commands
}

_notmuch_dump()
{
  _files
}

_notmuch_help_topics()
{
  local -a notmuch_help_topics
  notmuch_help_topics=(
    'search-terms:show common search-terms syntax'
  )
  _describe -t notmuch-help-topics 'topic' notmuch_help_topics
}

_notmuch_help()
{
  _alternative \
    _notmuch_commands \
    _notmuch_help_topics
}

_notmuch_restore()
{
  _files
}

_notmuch_search()
{
  _arguments -s : \
    '--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"))'
}

_notmuch()
{
  if (( CURRENT > 2 )) ; then
    local cmd=${words[2]}
    curcontext="${curcontext%:*:*}:notmuch-$cmd"
    (( CURRENT-- ))
    shift words
    _call_function ret _notmuch_$cmd
    return ret
  else
    _notmuch_commands
  fi
}

_notmuch "$@"

# vim: set sw=2 sts=2 ts=2 et ft=zsh :

                 reply	other threads:[~2011-01-23 23:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3nnql4h.fsf@yoom.home.cworth.org \
    --to=cworth@cworth.org \
    --cc=ingmar@exherbo.org \
    --cc=schizo@debian.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).