Browse code

Merge branch 'master' of https://github.com/FedyashevNikita/oh-my-zsh into FedyashevNikita-master

Robby Russell authored on 19/11/2010 at 18:41:11
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,104 @@
0
+#compdef vagrant 
1
+#autoload
2
+
3
+# vagrant zsh completion
4
+
5
+local -a _1st_arguments
6
+_1st_arguments=(
7
+    'box:Box commands'
8
+    'destroy:Destroys the vagrant environment'
9
+    'halt:Halts the currently running vagrant environment'
10
+    'help:[TASK] Describe available tasks or one specific task'
11
+    'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
12
+    'package:Packages a vagrant environment for distribution'
13
+    'provision:Run the provisioner'
14
+    'reload:Reload the vagrant environment'
15
+    'resume:Resumes a suspend vagrant environment'
16
+    'ssh:SSH into the currently running environment'
17
+    'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.'
18
+    'status:Shows the status of the current Vagrant environment.'
19
+    'suspend:Suspends the currently running vagrant environment'
20
+    'up:Creates the vagrant environment'
21
+    'version:Prints the Vagrant version information'
22
+)
23
+
24
+local -a _box_arguments
25
+_box_arguments=(
26
+    'add:NAME URI Add a box to the system'
27
+    'help:COMMAND Describe subcommands or one specific subcommand'
28
+    'list:Lists all installed boxes'
29
+    'remove:NAME Remove a box from the system'
30
+    'repackage:NAME Repackage an installed box into a `.box` file.'
31
+)
32
+
33
+__task_list ()
34
+{
35
+    local expl
36
+    declare -a tasks
37
+
38
+    tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version)
39
+
40
+    _wanted tasks expl 'help' compadd $tasks
41
+}
42
+
43
+__box_list ()
44
+{
45
+    _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
46
+}
47
+
48
+__vagrant-box ()
49
+{
50
+    local curcontext="$curcontext" state line
51
+    typeset -A opt_args
52
+
53
+    _arguments -C \
54
+        ':command:->command' \
55
+        '*::options:->options'
56
+
57
+   case $state in
58
+       (command)
59
+           _describe -t commands "gem subcommand" _box_arguments
60
+           return
61
+       ;;
62
+
63
+       (options)
64
+           case $line[1] in
65
+               (repackage|remove)
66
+                   _arguments ':feature:__box_list' 
67
+               ;;
68
+           esac
69
+       ;;
70
+    esac
71
+}
72
+
73
+
74
+
75
+
76
+local expl
77
+local -a boxes installed_boxes
78
+
79
+local curcontext="$curcontext" state line
80
+typeset -A opt_args
81
+
82
+_arguments -C \
83
+    ':command:->command' \
84
+    '*::options:->options'
85
+
86
+case $state in
87
+  (command)
88
+      _describe -t commands "gem subcommand" _1st_arguments
89
+      return
90
+  ;;
91
+
92
+  (options)
93
+    case $line[1] in
94
+      (help)
95
+         _arguments ':feature:__task_list' 
96
+      ;;
97
+
98
+      (box)
99
+          __vagrant-box
100
+      ;;
101
+    esac
102
+  ;;
103
+esac
0 104
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+fpath=($ZSH/plugins/vagrant $fpath)
1
+autoload -U compinit
2
+compinit -i