Compare commits

...

4 commits

Author SHA1 Message Date
Hippolyte Chauvin
e1f4d4350b Ajout : comportement par défaut si aucun argument n'est passé dans
qemush
2023-10-15 13:53:11 +02:00
Hippolyte Chauvin
a0c2e2cf43 Correction : reformattage dans qemush
ratio le formattage de helix
2023-10-15 13:51:53 +02:00
Hippolyte Chauvin
720d37b5a1 Correction : dans qemush, changement de l'ordre des fonctions dans la
fonction d'aide
2023-10-15 13:50:52 +02:00
Hippolyte Chauvin
3497bd31e9 Ajout : fonctions pour ajouter ou supprimer des VM dans qemush 2023-10-15 13:50:03 +02:00

View file

@ -23,14 +23,16 @@ public_help() {
name="$(basename "$0")"
cat << EOF
${name}: usage:
${name} active - (default behaviour) list active VMs
${name} start <VM name> - start a VM
${name} watch <VM name> - attach VM screen session
${name} active - (default behaviour) list active VMs
${name} list - list available VMs
${name} help - show this help
${name} add <VM name> <template> - add launch script based on template
${name} rm <VM name> - delete launch script
${name} diskls - list available disk images
${name} diskadd <disk name> <size> - create a disk image
${name} diskrm <disk name> - delete disk image
${name} help - show this help
EOF
}
@ -77,10 +79,20 @@ public_diskls() {
ls --color=auto images
}
public_add() {
ln -vs "$2" "bin/${1}"
}
public_rm() {
unlink "bin/${1}"
}
function="$1"
shift
if declare -F | cut -d \ -f 3- | grep '^public_' | sed 's/^public_//' | grep -q "^${function}$"; then
if [ -z "$function" ]; then
public_active
elif declare -F | cut -d \ -f 3- | grep '^public_' | sed 's/^public_//' | grep -q "^${function}$"; then
"public_${function}" "$@"
else
error_usage