mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
delete vm gum --choose-if-one
This commit is contained in:
parent
696dcc822d
commit
187120fac8
1 changed files with 17 additions and 25 deletions
42
qrun
42
qrun
|
@ -30,7 +30,6 @@ _define_variables() {
|
||||||
export GUM_FILTER_PROMPT_FOREGROUND="$color"
|
export GUM_FILTER_PROMPT_FOREGROUND="$color"
|
||||||
export GUM_FILTER_SELECTED_PREFIX_FOREGROUND="$color"
|
export GUM_FILTER_SELECTED_PREFIX_FOREGROUND="$color"
|
||||||
export GUM_FILTER_SELECTED_PREFIX_BORDER_FOREGROUND="$color"
|
export GUM_FILTER_SELECTED_PREFIX_BORDER_FOREGROUND="$color"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_generate_supported(){
|
_generate_supported(){
|
||||||
|
@ -109,7 +108,6 @@ show_headers() {
|
||||||
vms_run+="$running_logo$instance "
|
vms_run+="$running_logo$instance "
|
||||||
done
|
done
|
||||||
fi
|
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))
|
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[@]}"))
|
vms_not_next=$(gum style < <(printf '%s\n' "${vms_not[@]}"))
|
||||||
if [ -n "$(find . -name '*.pid')" ]; then
|
if [ -n "$(find . -name '*.pid')" ]; then
|
||||||
|
@ -222,25 +220,25 @@ kill_vm() {
|
||||||
}
|
}
|
||||||
# test
|
# test
|
||||||
kill_vms() {
|
kill_vms() {
|
||||||
gum_choose_runnings
|
gum_choose_runnings
|
||||||
if [ -n "$selected" ]; then
|
if [ -n "$selected" ]; then
|
||||||
for vm_name in "${selected[@]}"; do
|
for vm_name in "${selected[@]}"; do
|
||||||
gum confirm "Really kill $vm_name?"
|
gum confirm "Really kill $vm_name?"
|
||||||
pid=$(cat "${vm_name}.pid")
|
pid=$(cat "${vm_name}.pid")
|
||||||
kill "$pid"
|
kill "$pid"
|
||||||
done
|
done
|
||||||
show_headers
|
show_headers
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# test
|
|
||||||
gum_choose_VM_to_delete() {
|
gum_choose_VM_to_delete() {
|
||||||
if [ -n "$(echo *.conf)" ]; then
|
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
|
gum confirm "Really delete $chosen" && rm -r "$chosen" && rm "$chosen".conf
|
||||||
show_headers
|
show_headers
|
||||||
else
|
else
|
||||||
gum style --foreground 1 "No VMs!"
|
gum style --foreground 1 "No VMs!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
open_distro_homepage(){
|
open_distro_homepage(){
|
||||||
|
@ -254,12 +252,6 @@ need Nerd Fonts" && echo "yes" > /tmp/icons || rm /tmp/icons
|
||||||
show_headers
|
show_headers
|
||||||
}
|
}
|
||||||
|
|
||||||
icons_or() {
|
|
||||||
gum confirm " Use icons?
|
|
||||||
need Nerd Fonts" && echo "yes" > /tmp/icons || rm /tmp/icons
|
|
||||||
show_headers
|
|
||||||
}
|
|
||||||
|
|
||||||
# MENU
|
# MENU
|
||||||
_show_menu() {
|
_show_menu() {
|
||||||
while true
|
while true
|
||||||
|
|
Loading…
Reference in a new issue