aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <pcmsinan@gmail.com>2023-02-19 19:50:01 +0530
committersinanmohd <pcmsinan@gmail.com>2023-02-19 21:35:40 +0530
commitb5614b954cc2913efa6e389f8b9f6b2f73c9618f (patch)
tree419b60bb27fcf97f127f38e0518c9628894aabc7
parent06616836d10b10b5c78d517d3d212187d6e2f130 (diff)
fix: getopts, properly handle optargs
-rwxr-xr-xsoibox15
1 files changed, 7 insertions, 8 deletions
diff --git a/soibox b/soibox
index 2c931d0..a53fbc0 100755
--- a/soibox
+++ b/soibox
@@ -16,13 +16,13 @@ usage()
--version Echo the ${0##*/} version
Options:
-i Ignore global config
- -l 0-3 Loglevel, 1 being nothing, 2 being errors, and 3 all
+ -l [0-3] Loglevel, 1 being nothing, 2 being errors, and 3 all
-m [1-4] Enable performance overlay, 4 being the most verbose
-g Use feral's gamemode
-s Use gamescope
-d Dryrun, shows you errors in config
-b Use BindToInterface to block wan activity
- -f [profile] Use firejail for sandboxing games
+ -f <profile> Use firejail for sandboxing games
EOF
}
@@ -164,7 +164,7 @@ parse_opts()
shift
fi
- while getopts ":r:m:il:gsfdb" f
+ while getopts "r:m:il:gsf:bd" f
do
case "$f" in
r)
@@ -174,13 +174,13 @@ parse_opts()
die "$local_config, no such file"
;;
m)
- mangohud="${OPTARG:-on}"
+ mangohud="$OPTARG"
;;
i)
ignore_globalconf=true
;;
l)
- loglevel="${OPTARG:?l: loglevel cant be empty}"
+ loglevel="$OPTARG"
;;
g)
gamemode=on
@@ -189,8 +189,7 @@ parse_opts()
gamescope=on
;;
f)
- firejail=on
- firejail_prof="$OPTARG"
+ firejail="$OPTARG"
;;
b)
bind_interface=on
@@ -198,7 +197,7 @@ parse_opts()
d)
dry_run=true
;;
- *)
+ ?)
usage
exit 1
;;