From 183f6b06d09fa3ed143a098f2fc5f7b6c17af7ef Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 26 Feb 2001 15:05:37 +0000 Subject: [PATCH] some small functions for completing sub-commands (generic function, init scripts, apachectl) (13536) --- ChangeLog | 5 +++++ Completion/Base/_sub_commands | 9 +++++++++ Completion/Core/_normal | 4 ++++ Completion/User/_apachectl | 3 +++ Completion/User/_init_d | 5 +++++ 5 files changed, 26 insertions(+) create mode 100755 Completion/Base/_sub_commands create mode 100755 Completion/User/_apachectl create mode 100755 Completion/User/_init_d diff --git a/ChangeLog b/ChangeLog index c479944ad..ed046831c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2001-02-26 Sven Wischnowsky + * 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, diff --git a/Completion/Base/_sub_commands b/Completion/Base/_sub_commands new file mode 100755 index 000000000..429931a16 --- /dev/null +++ b/Completion/Base/_sub_commands @@ -0,0 +1,9 @@ +#autoload + +local expl + +if [[ CURRENT -eq 2 ]]; then + _wanted commands expl command compadd "$@" +else + _message 'no more arguments' +fi diff --git a/Completion/Core/_normal b/Completion/Core/_normal index 02229835a..364a56764 100644 --- a/Completion/Core/_normal +++ b/Completion/Core/_normal @@ -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}" diff --git a/Completion/User/_apachectl b/Completion/User/_apachectl new file mode 100755 index 000000000..6516b1f84 --- /dev/null +++ b/Completion/User/_apachectl @@ -0,0 +1,3 @@ +#compdef apachectl + +_sub_commands start startssl stop restart fullstatus status graceful configtest help diff --git a/Completion/User/_init_d b/Completion/User/_init_d new file mode 100755 index 000000000..134b91cc5 --- /dev/null +++ b/Completion/User/_init_d @@ -0,0 +1,5 @@ +#compdef -P */(init|rc[0-9]#).d/* + +# This should probably be system specific... + +_sub_commands start stop