aboutsummaryrefslogtreecommitdiffstats
path: root/_ditz
blob: b96f111e1fef21d8b0ab1c2e6400c3e0fa3674b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
# ------------------------------------------------------------------------------


local ME=ditz
local COMMANDS=--commands
local OPTIONS='<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