qemush : ajout de jolis retours à la ligne

This commit is contained in:
Ahurac 2024-03-24 23:27:07 +01:00
parent 2fb08080bb
commit 42734333b0

View file

@ -46,6 +46,7 @@ EOF
error_usage() { error_usage() {
perror "invalid usage" perror "invalid usage"
>&2 public_help >&2 public_help
return 1 return 1
} }
@ -57,6 +58,7 @@ public_start() {
-name "$QEMUSH_NAME" \ -name "$QEMUSH_NAME" \
-monitor "unix:$(pathof socket),server,nowait" \ -monitor "unix:$(pathof socket),server,nowait" \
-daemonize -daemonize
if ! "$@"; then if ! "$@"; then
perror "error launching virtual machine \"${QEMUSH_NAME}\"" perror "error launching virtual machine \"${QEMUSH_NAME}\""
return 2 return 2
@ -75,6 +77,7 @@ public_attach() {
# List running virtual machines # List running virtual machines
public_running() { public_running() {
cd || return cd || return
echo "Running machines:" echo "Running machines:"
exec ls -t sockets/monitors exec ls -t sockets/monitors
} }
@ -82,6 +85,7 @@ public_running() {
# List available virtual machines entrypoints # List available virtual machines entrypoints
public_ls() { public_ls() {
cd || return cd || return
echo "Available machines:" echo "Available machines:"
exec ls launchers exec ls launchers
} }
@ -97,6 +101,7 @@ public_diskadd() {
public_diskrm() { public_diskrm() {
for disk in "$@"; do for disk in "$@"; do
export QEMUSH_NAME="$disk" export QEMUSH_NAME="$disk"
rm -vi -- "$(pathof disk)" rm -vi -- "$(pathof disk)"
done done
} }
@ -104,6 +109,7 @@ public_diskrm() {
# List available disks # List available disks
public_diskls() { public_diskls() {
cd || return cd || return
echo "Available disks:" echo "Available disks:"
exec ls disks exec ls disks
} }
@ -125,6 +131,7 @@ public_edit() {
# Delete a virtual machine entrypoint # Delete a virtual machine entrypoint
public_rm() { public_rm() {
cd ~/launchers || return cd ~/launchers || return
exec rm -vi -- "$@" exec rm -vi -- "$@"
} }
@ -170,6 +177,7 @@ public_do() {
# Expose SPICE via TCP # Expose SPICE via TCP
public_spice() { public_spice() {
export QEMUSH_NAME="$1" export QEMUSH_NAME="$1"
if [ -n "$2" ]; then if [ -n "$2" ]; then
port=$2 port=$2
else else