mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
plugins: Add vagrant plugin for OMB
This commit is contained in:
committed by
Koichi Murase
parent
2df8a256f1
commit
94e5f0f13a
33
plugins/vagrant/README.md
Normal file
33
plugins/vagrant/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# vagrant plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
The `vagrant plugin` adds several aliases for useful [vagrant](https://www.vagrantup.com/downloads) commands and [aliases](#aliases).
|
||||
|
||||
To use it, add `vagrant` to the plugins array of your bashrc file:
|
||||
|
||||
```
|
||||
plugins=(... vagrant)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Command | Description |
|
||||
|:------------------|:--------------------------------------------------------------|
|
||||
| `va` | command `vagrant` |
|
||||
| `vaver` | Show the vagrant version in this host |
|
||||
| `vaconf` | command `vagrant ssh-config` |
|
||||
| `vastat` | command `vagrant global-status` |
|
||||
| `vacheck` | command `vagrant validate` |
|
||||
| `vaport` | command `vagrant port` |
|
||||
| `vapvm` | command `vagrant plugin install *[ virtualbox \| libvirt ]*` |
|
||||
| `vapi` | command `vagrant plugin install *[ package ]*` |
|
||||
| `vapr` | command `vagrant plugin uninstall *[ package ]*` |
|
||||
| `vau` | command `vagrant up *[ virtualbox \| libvirt ]*` |
|
||||
| `vah` | command `vagrant halt` |
|
||||
| `vat` | command `vagrant destroy -f` |
|
||||
| `vai` | command `vagrant init -m *[ centos/7 ]*` |
|
||||
| `varel` | command `vagrant reload` |
|
||||
| `vaba` | command `vagrant box add` |
|
||||
| `vabr` | command `vagrant box remove` |
|
||||
| `vabl` | command `vagrant box list` |
|
70
plugins/vagrant/vagrant.plugin.sh
Normal file
70
plugins/vagrant/vagrant.plugin.sh
Normal file
@ -0,0 +1,70 @@
|
||||
#! bash oh-my-bash.module
|
||||
# Functions
|
||||
function vagrant-version(){
|
||||
vagrant --version
|
||||
}
|
||||
|
||||
function vagrant-init(){
|
||||
if [ -n "$1" ] ; then
|
||||
echo "Vagrant init for : $1 Creating...."
|
||||
vagrant init -m "$1"
|
||||
else
|
||||
echo "Usage : vai <box name>"
|
||||
echo "Example : vai centos/7"
|
||||
fi
|
||||
}
|
||||
|
||||
function vagrant-up(){
|
||||
if [ -n "$1" ] ; then
|
||||
echo "Vagrant up for provider : $1 Running...."
|
||||
vagrant up --provider "$1"
|
||||
else
|
||||
echo "Vagrant up for provider : virtualbox Running...."
|
||||
vagrant up
|
||||
fi
|
||||
}
|
||||
|
||||
function vagrant-plugin-vm(){
|
||||
case "$1" in
|
||||
"virtualbox")
|
||||
echo "Vagrant plugin install for provider : $1 Running...."
|
||||
vagrant plugin install vagrant-vbguest
|
||||
;;
|
||||
"libvirt")
|
||||
echo "Vagrant plugin install for provider : $1 Running...."
|
||||
vagrant plugin install vagrant-libvirt
|
||||
;;
|
||||
*)
|
||||
echo "Usage : vapvm <provider name>"
|
||||
echo "Example : vapvm virtualbox"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function vagrant-status(){
|
||||
if [ -f "Vagrantfile" ]; then
|
||||
vagrant status
|
||||
else
|
||||
vagrant global-status
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Alias
|
||||
alias va='vagrant'
|
||||
alias vaver='vagrant-version'
|
||||
alias vaconf='vagrant ssh-config'
|
||||
alias vastat='vagrant-status'
|
||||
alias vacheck='vagrant validate'
|
||||
alias vaport='vagrant port'
|
||||
alias vapvm='vagrant-plugin-vm'
|
||||
alias vapi='vagrant plugin install'
|
||||
alias vapr='vagrant plugin uninstall'
|
||||
alias vau='vagrant-up'
|
||||
alias vah='vagrant halt'
|
||||
alias vat='vagrant destroy -f'
|
||||
alias vai='vagrant-init'
|
||||
alias varel='vagrant reload'
|
||||
alias vaba='vagrant box add'
|
||||
alias vabr='vagrant box remove'
|
||||
alias vavl='vagrant box list'
|
Reference in New Issue
Block a user