Skip to content

Commit

Permalink
xpadneo, installer: Add new option parser to support multiple options
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Dec 12, 2024
1 parent 7d4e210 commit b472272
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

cd "$(dirname "$0")" || exit 1
source "lib/verbose.sh"
source "lib/options.sh"
source "lib/installer.sh"

if [[ ! -d /sys/devices/virtual/misc/uhid ]]; then
Expand Down
26 changes: 26 additions & 0 deletions lib/options.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# shellcheck disable=SC2046
OPTIONS=$(getopt --name "$0" --longoptions "verbose" -- "" "$@") || exit 1
# shellcheck disable=SC2086
eval set -- $OPTIONS

while true; do
case "$1" in
--verbose)
echo "* verbose mode enabled"
# shellcheck disable=SC2034
V=("$1")
;;
--)
shift
break
;;
*)
echo "usage: $0 [--verbose]"
exit 1
esac
shift
done

[ ${#V[*]} -gt 0 ] && set -x
15 changes: 0 additions & 15 deletions lib/verbose.sh

This file was deleted.

2 changes: 1 addition & 1 deletion uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

cd "$(dirname "$0")" || exit 1
source "lib/verbose.sh"
source "lib/options.sh"
source "lib/installer.sh"

echo "* unloading current driver module"
Expand Down

0 comments on commit b472272

Please sign in to comment.