Added help option -h.
This commit is contained in:
parent
15ec1bcb92
commit
829ad08a7b
@ -57,6 +57,15 @@ checklist() {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo -e "Usage:\n"
|
||||||
|
echo "With no arguments, open the game launcher."
|
||||||
|
for i in "${!command[@]}" ; do
|
||||||
|
echo "-${i}: ${command[${i}]}"
|
||||||
|
done | sort
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
install_wine_bottle() {
|
install_wine_bottle() {
|
||||||
local bottle="${game,,}"
|
local bottle="${game,,}"
|
||||||
bottle="${bottle//[[:space:]]/-}"
|
bottle="${bottle//[[:space:]]/-}"
|
||||||
@ -249,17 +258,21 @@ if [[ $# -eq 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Array of command line arguments
|
# Array of command line arguments
|
||||||
command=(
|
declare -A command=(
|
||||||
"c" # Check wine environment
|
[c]="Check your system for necessary components."
|
||||||
"i" # Install games
|
[h]="This help screen."
|
||||||
"m" # Manually handle install screens
|
[i]="Install games."
|
||||||
"r" # Remove a game
|
[m]="Manually handle install screens instead of using xdotools."
|
||||||
|
[r]="Remove a game. This will delete all game data."
|
||||||
)
|
)
|
||||||
|
|
||||||
while getopts "${command[*]//[[:space:]]/}" i ; do
|
# Convert the keys of the associative array to a format usable by getopts
|
||||||
|
args="${!command[*]}"
|
||||||
|
args="${args//[[:space:]]/}"
|
||||||
|
while getopts "${args}" i ; do
|
||||||
case "$i" in
|
case "$i" in
|
||||||
c) checklist;;
|
c) checklist;;
|
||||||
h) show_help;;
|
h) help;;
|
||||||
i) game_installer;;
|
i) game_installer;;
|
||||||
m) manualInstall="true";;
|
m) manualInstall="true";;
|
||||||
r) game_removal;;
|
r) game_removal;;
|
||||||
|
Loading…
Reference in New Issue
Block a user