delete vm gum --choose-if-one

This commit is contained in:
zenobit 2023-12-16 19:28:00 +01:00
parent 696dcc822d
commit 187120fac8
1 changed files with 17 additions and 25 deletions

12
qrun
View File

@ -30,7 +30,6 @@ _define_variables() {
export GUM_FILTER_PROMPT_FOREGROUND="$color"
export GUM_FILTER_SELECTED_PREFIX_FOREGROUND="$color"
export GUM_FILTER_SELECTED_PREFIX_BORDER_FOREGROUND="$color"
}
_generate_supported(){
@ -109,7 +108,6 @@ show_headers() {
vms_run+="$running_logo$instance "
done
fi
#vms_not=($(comm -23 <(printf "%s\n" "${vms[@]}" | rev | cut -d'.' -f2-9 | rev | sort) <(printf "%s\n" "${vms_running[@]}" | sort)))
mapfile -t vms_not < <(comm -23 <(printf "%s\n" "${vms[@]}" | rev | cut -d'.' -f2-9 | rev | sort) <(printf "%s\n" "${vms_running[@]}" | sort))
vms_not_next=$(gum style < <(printf '%s\n' "${vms_not[@]}"))
if [ -n "$(find . -name '*.pid')" ]; then
@ -232,10 +230,10 @@ kill_vms() {
show_headers
fi
}
# test
gum_choose_VM_to_delete() {
if [ -n "$(echo *.conf)" ]; then
chosen=$(echo "${vms[@]%.*}" | tr " " "\n" | gum choose)
chosen=$(echo "${vms[@]%.*}" | tr " " "\n" | gum choose --select-if-one)
gum confirm "Really delete $chosen" && rm -r "$chosen" && rm "$chosen".conf
show_headers
else
@ -254,12 +252,6 @@ need Nerd Fonts" && echo "yes" > /tmp/icons || rm /tmp/icons
show_headers
}
icons_or() {
gum confirm " Use icons?
need Nerd Fonts" && echo "yes" > /tmp/icons || rm /tmp/icons
show_headers
}
# MENU
_show_menu() {
while true