zsh-completions/src/_ditz

54 lines
1.4 KiB
Bash

#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)
#
# ------------------------------------------------------------------------------
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
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et