#18 Ditz: add @technolize's _ditz
This commit is contained in:
parent
faa5c2ee04
commit
1ab8d9f003
|
@ -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='<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
|
Loading…
Reference in New Issue