mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-17 11:30:23 +01:00
handle snapshot completion entirely with awk
fixes #5 Also list and complete snapshot uuid.
This commit is contained in:
13
VBoxManage
13
VBoxManage
@@ -271,11 +271,14 @@ _VBoxManage() {
|
|||||||
snap=$(VBoxManage snapshot "${name//\\/}" \
|
snap=$(VBoxManage snapshot "${name//\\/}" \
|
||||||
list | \
|
list | \
|
||||||
grep UUID |
|
grep UUID |
|
||||||
awk -F ': ' '{print $2}' | \
|
awk -F ': *' -v ORS='|' '/UUID: / {
|
||||||
sed 's/ (.*//' | \
|
n=$2; u=$3
|
||||||
tr '\n' '|' | \
|
sub(/..UUID/, "", n)
|
||||||
sed 's/|$//' | \
|
gsub(/ /, "\\ ", n);
|
||||||
sed 's/\s/\\ /g')
|
sub(/[)].*/, "", u)
|
||||||
|
print n; print u
|
||||||
|
}'
|
||||||
|
)
|
||||||
IFS='|' read -ra snap <<< "$snap"
|
IFS='|' read -ra snap <<< "$snap"
|
||||||
|
|
||||||
for item in "${snap[@]}"
|
for item in "${snap[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user