This allows users to disable a plugin without completely removing it. Instead, they simply remove the `plugins/enabled/*.bash` file for the plugin they want to disable. This continues the concept of "everything on" while providing greater flexibility to future users. It might be a good idea to allow turning these off by default in the future and allowing not only the `plugins/enabled/*.bash` files but also an array of `<plugin_name>` values that would search for `plugins/available/<plugin_name>.plugin.bash` to enable them. That method would make it easier for people custom tune their plugins from within their `.bash_profile` script.
51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
#!/bin/bash
|
|
_vagrant()
|
|
{
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version"
|
|
|
|
if [ $COMP_CWORD == 1 ]
|
|
then
|
|
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
|
return 0
|
|
fi
|
|
|
|
if [ $COMP_CWORD == 2 ]
|
|
then
|
|
case "$prev" in
|
|
"box")
|
|
box_commands="add help list remove repackage"
|
|
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
"help")
|
|
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if [ $COMP_CWORD == 3 ]
|
|
then
|
|
action="${COMP_WORDS[COMP_CWORD-2]}"
|
|
if [ $action == 'box' ]
|
|
then
|
|
case "$prev" in
|
|
"remove"|"repackage")
|
|
local box_list=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ')
|
|
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
}
|
|
complete -F _vagrant vagrant
|
|
|