From a0c2e2cf43a449c572474d3ab95e8c9c2a3bce15 Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Sun, 15 Oct 2023 13:51:53 +0200 Subject: [PATCH] Correction : reformattage dans qemush ratio le formattage de helix --- bin/qemush | 56 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/bin/qemush b/bin/qemush index 3b968bf..6333929 100755 --- a/bin/qemush +++ b/bin/qemush @@ -1,27 +1,27 @@ #!/bin/bash exec_as() { - local user="$1" - shift + local user="$1" + shift - if [ "$(whoami)" != "$user" ]; then - exec sudo -u "$user" "$0" "$@" - else - cd - fi + if [ "$(whoami)" != "$user" ]; then + exec sudo -u "$user" "$0" "$@" + else + cd + fi } exec_as qemu "$@" || exit PATH="./bin:${PATH}" perror() { - >&2 printf '\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*" + >&2 printf '\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*" } public_help() { - local name - name="$(basename "$0")" - cat << EOF + local name + name="$(basename "$0")" + cat << EOF ${name}: usage: ${name} active - (default behaviour) list active VMs ${name} start - start a VM @@ -37,46 +37,46 @@ EOF } error_usage() { - perror "Invalid usage" - >&2 public_help - return 1 + perror "Invalid usage" + >&2 public_help + return 1 } public_start() { - local vm_name="$1" - shift + local vm_name="$1" + shift - screen -d -m -S "$vm_name" "$vm_name" "$@" + screen -d -m -S "$vm_name" "$vm_name" "$@" } public_watch() { - screen -dr "$1" + screen -dr "$1" } public_active() { - screen -ls + screen -ls } public_list() { - echo "Available machines:" - ls --color=auto bin + echo "Available machines:" + ls --color=auto bin } diskpath() { - printf 'images/%s.qcow2' "$1" + printf 'images/%s.qcow2' "$1" } public_diskadd() { - qemu-img create -f qcow2 "$(diskpath "$1")" "$2" + qemu-img create -f qcow2 "$(diskpath "$1")" "$2" } public_diskrm() { - rm -vi -- "$(diskpath "$1")" + rm -vi -- "$(diskpath "$1")" } public_diskls() { - echo "Available disks:" - ls --color=auto images + echo "Available disks:" + ls --color=auto images } public_add() { @@ -91,7 +91,7 @@ function="$1" shift if declare -F | cut -d \ -f 3- | grep '^public_' | sed 's/^public_//' | grep -q "^${function}$"; then - "public_${function}" "$@" + "public_${function}" "$@" else - error_usage + error_usage fi