qemush : commande active -> running

This commit is contained in:
Ahurac 2024-01-25 14:41:20 +01:00
parent d515a0bb23
commit 12eeb64347

View file

@ -38,7 +38,7 @@ public_help() {
exec cat << EOF exec cat << EOF
${name}: usage: ${name}: usage:
${name} active - (default behaviour) list active VMs ${name} running - (default behaviour) list running VMs
${name} start <VM name> - start a VM ${name} start <VM name> - start a VM
${name} watch <VM name> - attach VM screen session ${name} watch <VM name> - attach VM screen session
${name} ls - list available VMs ${name} ls - list available VMs
@ -84,7 +84,7 @@ public_watch() {
} }
# List running virtual machines # List running virtual machines
public_active() { public_running() {
cd || return cd || return
echo "Running machines:" echo "Running machines:"
set -- $ls -t sockets "$@" set -- $ls -t sockets "$@"
@ -182,7 +182,7 @@ shift
# Defauts to `active` if no function is supplied; else checks for a public # Defauts to `active` if no function is supplied; else checks for a public
# function named after the argument; else fails # function named after the argument; else fails
if [ -z "$function" ]; then if [ -z "$function" ]; then
public_active public_running
elif declare -F | cut -d \ -f 3- | grep '^public_' | sed 's/^public_//' | grep -q "^${function}$"; then elif declare -F | cut -d \ -f 3- | grep '^public_' | sed 's/^public_//' | grep -q "^${function}$"; then
"public_${function}" "$@" "public_${function}" "$@"
else else