Added discardstate command

This commit is contained in:
2015-04-09 21:22:11 +02:00
parent 7df3e8c621
commit 20e85255c1
2 changed files with 31 additions and 2 deletions

View File

@@ -7,7 +7,6 @@
#
# [1] Sebastian T. Hafner <sonix@own-hero.net>
#
# [ ] discardstate
# [ ] export
# [ ] extpack
# [ ] getextradata
@@ -110,6 +109,28 @@ _VBoxManage() {
done
}
_vms_state_comp() {
local command=$1
local cur=$2
local vms
local item
compopt -o filenames
vms=$(VBoxManage list vms -l | \
egrep '^Name|State' | \
egrep -B1 'State:\s+saved' | \
grep Name |sed 's/Name:\s\+//' | \
tr '\n' '|' | \
sed 's/|$//' | \
sed 's/"//g')
IFS='|' read -ra vms <<< "$vms"
for item in "${vms[@]}"
do
[[ ${item^^} == ${cur^^}* ]] && COMPREPLY+=("$item")
done
}
_list_comp() {
local cur=$1
local list
@@ -348,7 +369,10 @@ _VBoxManage() {
case "${cmd}" in
adoptstate)
_vms_comp vms ${cur}
_find_item_name 2
COMPREPLY=()
[[ -z "${name}" ]] &&
_vms_state_comp ${cur}
;;
bandwidthctl)
local items=(add set remove list)
@@ -734,6 +758,10 @@ _VBoxManage() {
fi
;;
discardstate)
_find_item_name 2
COMPREPLY=()
[[ -z "${name}" ]] &&
_vms_state_comp ${cur}
;;
"export")
;;