1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-19 13:37:58 +01:00

Added missing gnu sed definition and some cosmetic changes for completion script.

This commit is contained in:
2021-04-13 21:43:55 +02:00
parent 2984109bd5
commit c51603644b

11
box.py
View File

@@ -37,7 +37,8 @@ power_state:
''')
COMPLETIONS = {'bash': '''\
_boxpy() {
local cur prev words cword
local cur prev words cword _GNUSED
_GNUSED=${GNUSED:-sed}
# Complete registered VM names.
# Issues are the same as in above function.
@@ -55,16 +56,16 @@ _boxpy() {
running_vms=$(VBoxManage list runningvms | \
awk -F ' {' '{ print $1 }' | \
tr '\n' '|' | \
$VBMC_SED 's/|$//' | \
$VBMC_SED 's/"//g')
$_GNUSED 's/|$//' | \
$_GNUSED 's/"//g')
IFS='|' read -ra running_vms <<< "$running_vms"
fi
vms=$(VBoxManage list $command | \
awk -F ' {' '{ print $1 }' | \
tr '\n' '|' | \
$VBMC_SED 's/|$//' | \
$VBMC_SED 's/"//g')
$_GNUSED 's/|$//' | \
$_GNUSED 's/"//g')
IFS='|' read -ra vms <<< "$vms"
for item in "${vms[@]}"
do