148c14e4f7e3ee9134807304a7c38682276e918c
- Author
- Fedyashev Nikita <loci.master@gmail.com>
- Committer
- Fedyashev Nikita <loci.master@gmail.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..4cd6a46d22d11b6b67ce3af97dad5f8a888bd568
4--- /dev/null
5+++ b/plugins/vagrant/_vagrant
6@@ -0,0 +1,139 @@
7+#compdef vagrant
8+#autoload
9+
10+# vagrant zsh completion, based on homebrew completion
11+
12+__task_list ()
13+{
14+ local expl
15+ declare -a tasks
16+
17+ tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version)
18+
19+ _wanted tasks expl 'help' compadd $tasks
20+}
21+
22+__box_list ()
23+{
24+ _wanted application expl 'hxlp' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
25+}
26+
27+__vagrant-box ()
28+{
29+ local curcontext="$curcontext" state line
30+ typeset -A opt_args
31+
32+ _arguments -C \
33+ ':command:->command' \
34+ '*::options:->options'
35+
36+ case $state in
37+ (command)
38+
39+ # local -a subcommands
40+ # subcommands=(
41+ # 'start:Start a new release branch'
42+ # 'finish:Finish a release branche.'
43+ # 'list:List all your release branches. (Alias to `git flow release`)'
44+ # )
45+ # _describe -t commands 'git flow release' subcommands
46+ # _arguments \
47+ # -v'[Verbose (more) output]'
48+ _describe -t commands "gem subcommand" _box_arguments
49+ return
50+ ;;
51+
52+ (options)
53+ case $line[1] in
54+
55+ (repackage)
56+ _arguments \
57+ -F'[Fetch from origin before performing finish]' \
58+ -r'[Rebase instead of merge]'\
59+ ':feature:__box_list'
60+
61+
62+
63+ ;;
64+ esac
65+ ;;
66+ esac
67+
68+}
69+
70+local -a _1st_arguments
71+_1st_arguments=(
72+ 'box:Box commands'
73+ 'destroy:Destroys the vagrant environment'
74+ 'halt:Halts the currently running vagrant environment'
75+ 'help:[TASK] Describe available tasks or one specific task'
76+ 'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
77+ 'package:Packages a vagrant environment for distribution'
78+ 'provision:Run the provisioner'
79+ 'reload:Reload the vagrant environment'
80+ 'resume:Resumes a suspend vagrant environment'
81+ 'ssh:SSH into the currently running environment'
82+ 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.'
83+ 'status:Shows the status of the current Vagrant environment.'
84+ 'suspend:Suspends the currently running vagrant environment'
85+ 'up:Creates the vagrant environment'
86+ 'version:Prints the Vagrant version information'
87+)
88+
89+local -a _box_arguments
90+_box_arguments=(
91+ 'add:NAME URI Add a box to the system'
92+ 'help:COMMAND Describe subcommands or one specific subcommand'
93+ 'list:Lists all installed boxes'
94+ 'remove:NAME Remove a box from the system'
95+ 'repackage:NAME Repackage an installed box into a `.box` file.'
96+)
97+
98+local expl
99+local -a boxes installed_boxes
100+
101+#_arguments \
102+# '(-v --version)'{-v,--version}'[show version]' \
103+# '(-h --help)'{-h,--help}'[show help]' \
104+# '*:: :->subcmds' && return 0
105+ local curcontext="$curcontext" state line
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