mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-27 03:05:39 +01:00
pull latest bits from zsh-completions.git
-pulled in current _vagrant from zsh-completions.git
ff5a0d6d5f/src/_vagrant
This commit is contained in:
parent
fa679afbc2
commit
f687666b5c
1 changed files with 77 additions and 9 deletions
|
|
@ -1,5 +1,21 @@
|
||||||
#compdef vagrant
|
#compdef vagrant
|
||||||
#autoload
|
#autoload
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Description
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# Completion script for Vagrant (http://vagrantup.com).
|
||||||
|
#
|
||||||
|
# Source: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/vagrant
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Authors
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# * Nikita Fedyashev (https://github.com/nfedyashev)
|
||||||
|
# * Mark Cornick (https://github.com/markcornick)
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# vagrant zsh completion
|
# vagrant zsh completion
|
||||||
|
|
||||||
|
|
@ -12,10 +28,11 @@ _1st_arguments=(
|
||||||
'docker-run:Run one-off commands against a Docker container'
|
'docker-run:Run one-off commands against a Docker container'
|
||||||
'global-status:Reports the status of all active Vagrant environments on the system'
|
'global-status:Reports the status of all active Vagrant environments on the system'
|
||||||
'halt:Halts the currently running vagrant environment'
|
'halt:Halts the currently running vagrant environment'
|
||||||
|
'help:[TASK] Describe available tasks or one specific task'
|
||||||
'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
|
'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
|
||||||
'login:Authenticates against a Vagrant Cloud server to access protected boxes'
|
'login:Authenticates against a Vagrant Cloud server to access protected boxes'
|
||||||
'package:Packages a vagrant environment for distribution'
|
'package:Packages a vagrant environment for distribution'
|
||||||
'plugin:Plugin commands'
|
'plugin:Manage plugins'
|
||||||
'provision:Run the provisioner'
|
'provision:Run the provisioner'
|
||||||
'reload:Reload the vagrant environment'
|
'reload:Reload the vagrant environment'
|
||||||
'resume:Resumes a suspend vagrant environment'
|
'resume:Resumes a suspend vagrant environment'
|
||||||
|
|
@ -26,7 +43,6 @@ _1st_arguments=(
|
||||||
'suspend:Suspends the currently running vagrant environment'
|
'suspend:Suspends the currently running vagrant environment'
|
||||||
'up:Creates the vagrant environment'
|
'up:Creates the vagrant environment'
|
||||||
'version:Prints the currently installed Vagrant version and checks for new updates'
|
'version:Prints the currently installed Vagrant version and checks for new updates'
|
||||||
'--help:[TASK] Describe available tasks or one specific task'
|
|
||||||
'--version:Prints the Vagrant version information'
|
'--version:Prints the Vagrant version information'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -39,13 +55,22 @@ _box_arguments=(
|
||||||
'repackage:NAME Repackage an installed box into a `.box` file.'
|
'repackage:NAME Repackage an installed box into a `.box` file.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local -a _plugin_arguments
|
||||||
|
_plugin_arguments=(
|
||||||
|
'install:NAME Install a plugin to the system'
|
||||||
|
'license:NAME LICENSE_FILE Add a license for an installed plugin'
|
||||||
|
'list:Lists all installed plugins'
|
||||||
|
'uninstall:NAME Uninstall a plugin from the system'
|
||||||
|
'update:[NAMES...] Update all or specified plugins'
|
||||||
|
)
|
||||||
|
|
||||||
__task_list ()
|
__task_list ()
|
||||||
{
|
{
|
||||||
local expl
|
local expl
|
||||||
declare -a tasks
|
declare -a tasks
|
||||||
|
|
||||||
tasks=(box destroy halt init package provision reload resume ssh \
|
tasks=(box destroy global-status halt init package plugin provision \
|
||||||
ssh_config status suspend up version)
|
reload resume ssh ssh_config status suspend up version)
|
||||||
|
|
||||||
_wanted tasks expl 'help' compadd $tasks
|
_wanted tasks expl 'help' compadd $tasks
|
||||||
}
|
}
|
||||||
|
|
@ -57,6 +82,12 @@ __box_list ()
|
||||||
sed -e 's/ /\\ /g')
|
sed -e 's/ /\\ /g')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__plugin_list ()
|
||||||
|
{
|
||||||
|
_wanted application expl 'command' compadd $(command vagrant plugin list \
|
||||||
|
2>/dev/null| cut -d' ' -f1)
|
||||||
|
}
|
||||||
|
|
||||||
_vagrant_caching_policy()
|
_vagrant_caching_policy()
|
||||||
{
|
{
|
||||||
local reg_time comp_time check_file
|
local reg_time comp_time check_file
|
||||||
|
|
@ -83,7 +114,7 @@ _vagrant_caching_policy()
|
||||||
comp_time=${$(${(z)STATCMD} $1):Q}
|
comp_time=${$(${(z)STATCMD} $1):Q}
|
||||||
|
|
||||||
return $(( reg_time < comp_time ))
|
return $(( reg_time < comp_time ))
|
||||||
}
|
}
|
||||||
|
|
||||||
__vm_list ()
|
__vm_list ()
|
||||||
{
|
{
|
||||||
|
|
@ -123,21 +154,46 @@ __vagrant-box ()
|
||||||
(options)
|
(options)
|
||||||
case $line[1] in
|
case $line[1] in
|
||||||
(repackage|remove)
|
(repackage|remove)
|
||||||
_arguments ':feature:__box_list'
|
_arguments ':feature:__box_list'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__vagrant-plugin ()
|
||||||
|
{
|
||||||
|
local curcontext="$curcontext" state line
|
||||||
|
local -A opt_args
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
':command:->command' \
|
||||||
|
'*::options:->options'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
(command)
|
||||||
|
_describe -t commands "gem subcommand" _plugin_arguments
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
|
||||||
|
(options)
|
||||||
|
case $line[1] in
|
||||||
|
(license)
|
||||||
|
_arguments ':feature:__plugin_list' '*:file:_files'
|
||||||
|
;;
|
||||||
|
(uninstall)
|
||||||
|
_arguments ':feature:__plugin_list'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
local expl
|
local expl
|
||||||
local -a boxes installed_boxes
|
local -a boxes installed_boxes
|
||||||
|
|
||||||
local curcontext="$curcontext" state line
|
local curcontext="$curcontext" state line
|
||||||
typeset -A opt_args
|
local -A opt_args
|
||||||
|
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
':command:->command' \
|
':command:->command' \
|
||||||
|
|
@ -152,14 +208,26 @@ case $state in
|
||||||
(options)
|
(options)
|
||||||
case $line[1] in
|
case $line[1] in
|
||||||
(help)
|
(help)
|
||||||
_arguments ':feature:__task_list'
|
_arguments ':feature:__task_list'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(box)
|
(box)
|
||||||
__vagrant-box
|
__vagrant-box
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(plugin)
|
||||||
|
__vagrant-plugin
|
||||||
|
;;
|
||||||
(up|provision|package|destroy|reload|ssh|halt|resume|status|suspend)
|
(up|provision|package|destroy|reload|ssh|halt|resume|status|suspend)
|
||||||
_arguments ':feature:__vm_list'
|
_arguments ':feature:__vm_list'
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: Shell-Script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# indent-tabs-mode: nil
|
||||||
|
# sh-basic-offset: 2
|
||||||
|
# End:
|
||||||
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue