renaming continue

This commit is contained in:
zenobit 2023-03-31 05:18:02 +02:00
parent 3a23b6db14
commit 8f3adab524
1 changed files with 46 additions and 33 deletions

79
dh
View File

@ -315,18 +315,22 @@ EOF
tui_run tui_run
if [ "$todo" = "create" ]; then if [ "$todo" = "create" ]; then
virtual_machine_create virtual_machine_create
tui_windows if [ "$os" = windows ]; then
tui_get_releases_and_editions tui_windows
tui_get_releases
if [ "$(echo "$choices" | wc -l)" = 1 ]; then
tui_downloading
else else
tui_get_editions tui_get_releases_and_editions
tui_downloading_with_edition fzf_choose_release
if [ "$(echo "$choices" | wc -l)" = 1 ]; then
quickget_download_os_release
else
fzf_choose_edition
quickget_download_os_release_edition
fi
fi fi
else
virtual_machine_choose_to_run
virtual_machine_run
fi fi
virtual_machine_choose_to_run
virtual_machine_run
} }
tui_run() { tui_run() {
@ -361,50 +365,59 @@ EOF
choices=$("$portable_prefix"quickget "$os" | sed 1d) choices=$("$portable_prefix"quickget "$os" | sed 1d)
} }
tui_get_releases() { fzf_choose_release() {
release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release
or CTRL-c or ESC to quit') or CTRL-c or ESC to quit')
} }
tui_get_editions() { fzf_choose_edition() {
edition=$(echo "$choices" | grep 'Editions' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Edition edition=$(echo "$choices" | grep 'Editions' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Edition
or CTRL-c or ESC to quit') or CTRL-c or ESC to quit')
} }
tui_downloading() { quickget_download_os_release() {
printf $"\n Trying to download %s %s...\n\n" "$os" "$release" printf $"\n Trying to download %s %s...\n\n" "$os" "$release"
"$portable_prefix"quickget "$os" "$release" "$portable_prefix"quickget "$os" "$release"
} }
tui_downloading_with_edition() { quickget_download_os_release_edition() {
printf $"\n Trying to download %s %s %s...\n\n" "$os" "$release" "$edition" printf $"\n Trying to download %s %s %s...\n\n" "$os" "$release" "$edition"
"$portable_prefix"quickget "$os" "$release" "$edition" "$portable_prefix"quickget "$os" "$release" "$edition"
} }
tui_windows() { tui_windows() {
if [ "$os" = windows ]; then fzf_choose_language_windows_other
answer=$(echo "Default English if [ "$answer" = "Choose other language" ]; then
Choose other language" | fzf --cycle) fzf_choose_release_windows
# If the user wants another windows language quickget_get_windows_languages_list
if [ "$answer" = "Choose other language" ]; then fzf_choose_language_windows
wrelease=$(echo "8 quickget_download_windows
10
11" | fzf --cycle)
# get window language list
wlend=$(($(cat "$portable_prefix"quickget | sed '/Arabic/,$!d' | grep -n '}' | cut -d':' -f1 | head -n 1) - 1))
# get windows language
wlang=$(cat "$portable_prefix"quickget | sed '/Arabic/,$!d' | head -n $wlend | cut -d'=' -f2 | tail -c +2 | head -c -2 | sed 's/^[ \t]*//' | fzf --cycle --header='Choose Language
or CTRL-c or ESC to quit')
# downloading windows
printf $"\n Trying to download Windows %s %s...\n\n" "$wrelease" "$wlang"
"$portable_prefix"quickget "windows" "$wrelease" "$wlang"
fi
fi fi
} }
fzf_choose_language_windows_other() {
answer=$(echo "Default English
Choose other language" | fzf --cycle)
}
if [ "$answer" = "Choose other language" ]; then
fzf_choose_release_windows() {
wrelease=$(echo "8
10
11" | fzf --cycle)
}
quickget_get_windows_languages_list() {
wlend=$(($(cat "$portable_prefix"quickget | sed '/Arabic/,$!d' | grep -n '}' | cut -d':' -f1 | head -n 1) - 1))
}
fzf_choose_language_windows() {
wlang=$(cat "$portable_prefix"quickget | sed '/Arabic/,$!d' | head -n $wlend | cut -d'=' -f2 | tail -c +2 | head -c -2 | sed 's/^[ \t]*//' | fzf --cycle --header='Choose Language
or CTRL-c or ESC to quit')
}
quickget_download_windows() {
printf $"\n Trying to download Windows %s %s...\n\n" "$wrelease" "$wlang"
"$portable_prefix"quickget "windows" "$wrelease" "$wlang"
}
fi
virtual_machine_choose_to_run() { virtual_machine_choose_to_run() {
choosed=$(echo "$(ls ***.conf 2>/dev/null | sed 's/\.conf$//')" | fzf --cycle --header='Choose VM to run choosed=$(echo "$(ls ***.conf 2>/dev/null | sed 's/\.conf$//')" | fzf --cycle --header='Choose VM to run
or CTRL-c or ESC to quit') or CTRL-c or ESC to quit')