mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 07:02:50 +01:00
Add handling for multiple argument, version getting option and help
This commit is contained in:
1 parent
cf087d96c7
commit
f2124218e4
1 file changed
+51
-5
@@ -1092,13 +1092,59 @@ uninstall(){
|
|||||||
rm "$self"
|
rm "$self"
|
||||||
echo "Uninstall routine complete"
|
echo "Uninstall routine complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
read -r -d '' helptext <<- EOM
|
||||||
|
DZGUI - Free and Open Source DayZ launcher
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
dzgui.sh [options]
|
||||||
|
|
||||||
|
Description:
|
||||||
|
|
||||||
|
When no option is provided, the script launches DZGUI.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-u, --uninstall:
|
||||||
|
Uninstalls the software
|
||||||
|
|
||||||
|
-v, --version:
|
||||||
|
Prints the version
|
||||||
|
|
||||||
|
-h, --help:
|
||||||
|
Prints this message
|
||||||
|
EOM
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
local zenv=$(zenity --version 2>/dev/null)
|
# setup zenity environment
|
||||||
|
local zenv=""
|
||||||
|
zenv=$(zenity --version 2>/dev/null)
|
||||||
[[ -z $zenv ]] && { echo "Requires zenity >= ${deps[$steamsafe_zenity]}"; exit 1; }
|
[[ -z $zenv ]] && { echo "Requires zenity >= ${deps[$steamsafe_zenity]}"; exit 1; }
|
||||||
if [[ $1 == "--uninstall" ]] || [[ $1 == "-u" ]]; then
|
|
||||||
uninstall &&
|
# parse arguments
|
||||||
exit 0
|
while [[ $# -gt 0 ]]; do
|
||||||
fi
|
case $1 in
|
||||||
|
"--uninstall" | "-u")
|
||||||
|
uninstall
|
||||||
|
exit 0
|
||||||
|
# shift
|
||||||
|
;;
|
||||||
|
"--version" | "-v")
|
||||||
|
echo $version
|
||||||
|
exit 0
|
||||||
|
# shift
|
||||||
|
;;
|
||||||
|
"--help" | "-h")
|
||||||
|
echo "$helptext"
|
||||||
|
exit 0
|
||||||
|
# shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unrecognized command!"
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
set_im_module
|
set_im_module
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user