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

13
box.py
View File

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