From 1ab8d9f003cb9211f58f97096e66a457038fffbf Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sun, 25 Sep 2011 19:19:06 +0200 Subject: [PATCH] #18 Ditz: add @technolize's _ditz --- _ditz | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 _ditz diff --git a/_ditz b/_ditz new file mode 100644 index 0000000..744d5ac --- /dev/null +++ b/_ditz @@ -0,0 +1,48 @@ +#compdef ditz +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for Ditz (http://ditz.rubyforge.org). +# +# Source: https://github.com/technolize/zsh-completion-funcs +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * technolize (https://github.com/technolize) +# +# ------------------------------------------------------------------------------ +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------ + + +ME=ditz +COMMANDS=--commands +OPTIONS='' + +if (($CURRENT == 2)); then + # We're completing the first word after the tool: the command. + _wanted command expl "$ME command" \ + compadd -- $( "$ME" "$COMMANDS" ) +else + # Find the options/files/URL/etc. for the current command by using the tool itself. + case "${words[$CURRENT]}"; in + -*) + _wanted args expl "Arguments for $ME ${words[2]}" \ + compadd -- $( "$ME" "${words[2]}" "$OPTIONS" ; _files ) + ;; + ht*|ft*) + _arguments '*:URL:_urls' + ;; + /*|./*|\~*|../*) + _arguments '*:file:_files' + ;; + *) + _wanted args expl "Arguments for $ME ${words[2]}" \ + compadd -- $( "$ME" "${words[2]}" "$OPTIONS" ) + ;; + esac +fi