1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-03 09:21:19 +02:00

some small functions for completing sub-commands (generic function, init scripts, apachectl) (13536)

This commit is contained in:
Sven Wischnowsky 2001-02-26 15:05:37 +00:00
parent 006e9b9afb
commit 183f6b06d0
5 changed files with 26 additions and 0 deletions

@ -1,5 +1,10 @@
2001-02-26 Sven Wischnowsky <wischnow@zsh.org>
* 13536: Completion/Base/_sub_commands, Completion/Core/_normal,
Completion/User/_apachectl, Completion/User/_init_d: some small
functions for completing sub-commands (generic function, init
scripts, apachectl)
* 13534: Completion/Builtins/_fc, Completion/Builtins/_hash,
Completion/Builtins/_source, Completion/Builtins/_which,
Completion/Builtins/_zftp, Completion/User/_man,

9
Completion/Base/_sub_commands Executable file

@ -0,0 +1,9 @@
#autoload
local expl
if [[ CURRENT -eq 2 ]]; then
_wanted commands expl command compadd "$@"
else
_message 'no more arguments'
fi

@ -30,6 +30,10 @@ else
eval cmd1\=$command
cmd2="$command[2,-1]"
curcontext="${curcontext%:*:*}:${cmd2}:"
elif [[ "$command" = ..#/* ]]; then
cmd1="${PWD}/$command"
cmd2="${command:t}"
curcontext="${curcontext%:*:*}:${cmd2}:"
elif [[ "$command" = */* ]]; then
cmd1="$command"
cmd2="${command:t}"

3
Completion/User/_apachectl Executable file

@ -0,0 +1,3 @@
#compdef apachectl
_sub_commands start startssl stop restart fullstatus status graceful configtest help

5
Completion/User/_init_d Executable file

@ -0,0 +1,5 @@
#compdef -P */(init|rc[0-9]#).d/*
# This should probably be system specific...
_sub_commands start stop