Files
zsh-completions/src/_pear
T
Aaron Schrab 3f55429b0e Move modelines to end of file
Having a vim modeline or emacs local variable line somewhere in the
middle of the file isn't really helpful.  By default, vim will only
check the first and last 5 lines of a file for a modeline (assuming the
modeline option is enabled).  Emacs is even more strict about the type
of local variable line that was in use, it will only check the first
line of the file or the second line if the first line specifies a script
interpreter (which isn't the case here).

Move the vim modeline to the end of the file so that it can actually be
found by vim but is out of the way for editing.  For emacs more work is
required, convert that to the more verbose Local Variables syntax which
emacs will look for starting 3000 characters from the end of the file.

Also there is no zsh mode for emacs (according to
zsh-users/zsh-completions#75), use the "Shell-Script" mode instead.
This seems to automatically detect that the files are for zsh.

I'm not an emacs user, so I haven't tested that portion much.  But, this
does at least improve the syntax highlighting there.
2012-08-23 11:18:49 -04:00

90 lines
2.0 KiB
Bash

#compdef pear
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Pear (http://pear.php.net).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * aki77 (https://github.com/aki77)
#
# ------------------------------------------------------------------------------
_pear () {
local curcontext="$curcontext" state line expl ret=1
_arguments \
'1: :->subcmds' \
'*:: :->args' && ret=0
case $state in
subcmds)
_pear_commands
;;
args)
local cmd args
cmd=$words[1]
args=()
case $cmd in
channel-alias|channel-delete|channel-info|channel-update)
args+=(
':channel:_pear_discovered_channels'
)
;;
uninstall|upgrade|run-scripts)
args+=(
':package:_pear_installed_packages'
)
;;
esac
_arguments "$args[@]" && ret=0
return
;;
esac
return ret
}
_pear_commands () {
local commands
commands=(
${${(f)${"$(_call_program commands $service 2>&1)"#*Commands:}%Usage:*}/[[:blank:]]*[[:blank:]][[:blank:]]/:}
)
_describe -t commands 'Pear commands' commands
}
_pear_installed_packages () {
local packages
packages=(
${${(f)"$(pear list)"#*STATE}%%[[:blank:]]*}
)
_wanted package expl 'package' compadd -a packages
}
_pear_discovered_channels () {
local channels
channels=(
${${${(f)"$(_call_program commands pear list-channels)"#*SUMMARY}%__uri*}%%[[:blank:]]*}
)
_wanted channel expl 'channel' compadd -a channels
}
_pear "$@"
# 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