about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-02-26 15:05:37 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-02-26 15:05:37 +0000
commit183f6b06d09fa3ed143a098f2fc5f7b6c17af7ef (patch)
tree5cc0321cfadd91445aaa40fe9709ee15ae127697
parent006e9b9afba10e2e64d86538fe5777376c8f0f57 (diff)
downloadzsh-183f6b06d09fa3ed143a098f2fc5f7b6c17af7ef.tar.gz
zsh-183f6b06d09fa3ed143a098f2fc5f7b6c17af7ef.tar.xz
zsh-183f6b06d09fa3ed143a098f2fc5f7b6c17af7ef.zip
some small functions for completing sub-commands (generic function, init scripts, apachectl) (13536)
-rw-r--r--ChangeLog5
-rwxr-xr-xCompletion/Base/_sub_commands9
-rw-r--r--Completion/Core/_normal4
-rwxr-xr-xCompletion/User/_apachectl3
-rwxr-xr-xCompletion/User/_init_d5
5 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c479944ad..ed046831c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
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