arguments improved

This commit is contained in:
zenobit 2023-03-26 17:09:39 +02:00
parent bc29310628
commit ab299c39e8
1 changed files with 87 additions and 22 deletions

109
dh
View File

@ -16,15 +16,24 @@ some_bugs() {
show_help() { show_help() {
echo " echo "
Possible arguments: Possible arguments:
d Set where VMs are stored -h --help Show this help and exit
i Install DistroHopper ---------------------------------------------------------
s Update supported VMs -d --dir Set default directory where VMs are stored
t Run TUI instead of GUI -i --install Install DistroHopper
r Update ready to run VMs ---------------------------------------------------------
a Add new distro to quickget -m --mode Portable mode
h Show this help ---------------------------------------------------------
o Copy all ISOs to target dir (for Ventoy) -s --supported Update supported VMs
p Push changed quickget to quickemu project -r --ready Update ready to run VMs
---------------------------------------------------------
-t --tui Run TUI
-g --gui Run GUI
---------------------------------------------------------
-a --add Add new distro to quickget
-f --functions Sort functions in quickget
-p --push Push changed quickget to quickemu project #todo
---------------------------------------------------------
-c --copy Copy all ISOs to target dir (for Ventoy)
---------------------------------------------------------" ---------------------------------------------------------"
} }
@ -329,19 +338,75 @@ add_distro() {
set_variables set_variables
case "$1" in while [[ $# -gt 0 ]]
d) set_dir;; do
i) echo "Starting installation..." && install_process;; key="$1"
s) echo "Updating supported VMs..." && renew_supported;; case $key in
t) echo "You are master! Running TUI..." && run_tui;; -h|--help)
r) echo "Updating ready VMs..." && renew_ready;; show_help
a) echo "Adding new distro started..." && add_distro;; shift
h) show_help;; ;;
o) echo "Copying ISOs to dir. It will take some time..." && isos_to_dir;; -d|-dir)
p) echo "Nothing here yet!";; set_dir
*) echo "Run 'dh h' for help shift
Starting DistroHopper GUI..." && run_gui;; ;;
esac -i|--install)
echo "Starting installation..."
install_process
shift
;;
-m|--mode)
echo "Switching to portable mode!"
mode_portable
shift
;;
-s|--supported)
echo "Updating supported VMs..."
renew_supported
shift
;;
-r|--ready)
echo "Updating ready VMs..."
renew_ready
shift
;;
-t|--tui)
echo "Running TUI..."
run_tui
shift
;;
-g|--gui)
echo "Starting DistroHopper GUI..."
run_gui
shift
;;
-a|--add)
echo "Adding new distro started..."
add_distro
shift
;;
-f|--functions)
echo "Sorting functions in template..."
sort_functions
shift
;;
-p|--push)
echo "Pushing changes to... #TODO"
push_changes
shift
;;
-c|--copy)
echo "Copying ISOs to dir. It will take some time..."
isos_to_dir
shift
;;
*)
echo "Invalid option: $1"
show_help
exit 1
;;
esac
done
some_bugs some_bugs