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