commit e89642d9859e70052bd6ed4f76776e9cd49d54cc
parent 22cb15277862047b36e97d9da8da027de9482d1e
Author: Alex Balgavy <alex@balgavy.eu>
Date: Thu, 9 Sep 2021 10:35:26 +0200
Add startgui command
Diffstat:
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,3 +1,7 @@
+.POSIX:
+.PHONY: all install uninstall
+.SUFFIXES:
+
prefix=/usr/local
datarootdir=$(prefix)/share
datadir=$(datarootdir)
diff --git a/vbox b/vbox
@@ -7,7 +7,12 @@ command -v VBoxManage >/dev/null 2>&1 || die "VBoxManage cannot be found, please
command -v gstat >/dev/null 2>&1 && statcmd="gstat"
start() {
[ $# -eq 1 ] || die "Only one argument: VM name"
- VBoxManage startvm "$1" --type headless
+ VBoxManage startvm --type headless "$1"
+}
+
+startgui() {
+ [ $# -eq 1 ] || die "Only one argument: VM name"
+ VBoxManage startvm --type gui "$1"
}
stop_vm() {
@@ -17,7 +22,7 @@ stop_vm() {
open() {
[ $# -eq 1 ] || die "Only one argument: VM name"
- VBoxManage startvm "$1" --type separate
+ VBoxManage startvm --type separate "$1"
}
pause() {
@@ -128,6 +133,10 @@ case "$1" in
shift;
start "$@";
;;
+ "startgui")
+ shift;
+ startgui "$@";
+ ;;
"stop")
shift;
stop_vm "$@";
diff --git a/vbox.1.man b/vbox.1.man
@@ -19,6 +19,8 @@ Get help.
\fBstart vm-name\fP
Start the VM \fIvm-name\fP (in headless mode)
+\fBstartgui vm-name\fP
+Start the VM \fIvm-name\fP (in GUI mode)
.TP
\fBstop vm-name\fP
Stop the VM \fIvm-name\fP
diff --git a/vbox.zsh b/vbox.zsh
@@ -8,6 +8,7 @@ _vbox() {
local -a arguments
arguments=(
'start:start a VM'
+ 'startgui:start a VM in GUI mode'
'stop:stop a VM'
'open:open a VM, starting it if necessary'
'pause:pause a VM'
@@ -43,7 +44,7 @@ _vbox() {
':hostpath:_files -/' \
:machine:_vboxmachines
;;
- start|stop|open|status|info|shared|pause|suspend|resume)
+ start|startgui|stop|open|status|info|shared|pause|suspend|resume)
_arguments \
:machine:_vboxmachines
;;