Browse code

terminitor plugin: add autocompletion for start subcommand.

Philipp Bosch authored on 15/09/2011 at 13:18:15
Showing 1 changed files
... ...
@@ -3,6 +3,10 @@
3 3
 
4 4
 # terminitor zsh completion
5 5
 
6
+_terminitor_available_scripts() {
7
+  scripts=(`for SCRIPT in ~/.config/terminitor/*.term ; do basename $SCRIPT .term ; done`)
8
+}
9
+
6 10
 local -a _1st_arguments
7 11
 _1st_arguments=(
8 12
     'create:create a Termfile in directory'
... ...
@@ -17,6 +21,8 @@ _1st_arguments=(
17 17
     'update:update Terminitor to new global path(.config/.terminitor)'
18 18
 )
19 19
 
20
+local expl
21
+
20 22
 _arguments \
21 23
   '*:: :->subcmds' && return 0
22 24
 
... ...
@@ -24,3 +30,9 @@ if (( CURRENT == 1 )); then
24 24
   _describe -t commands "terminitor task" _1st_arguments
25 25
   return
26 26
 fi
27
+
28
+case "$words[1]" in
29
+  start)
30
+    _terminitor_available_scripts
31
+    _wanted scripts expl 'installed scripts' compadd -a scripts ;;
32
+esac