Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commandline: Allow set command to take 'global' instead of AppID #840

Merged
merged 3 commits into from
Jun 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20230616-1"
PROGVERS="v14.0.20230624-1"
PROGCMD="${0##*/}"
SHOSTL="stl"
GHURL="https://github.com"
Expand Down Expand Up @@ -20321,9 +20321,11 @@ function howto {
echo " without using steam."
echo " Optional <X> opens gui"
echo " proton|p list Update the list of all available proton versions"
echo " set <var> <for> <value> Change configuration settings"
echo " set <var> <for> <value> Change configuration settings, either per-game (<AppID>), for all games (<all>),"
echo " or in the Global config (<global>)"
echo " Example:"
echo " set RUN_REPLAY all 1 Set RUN_REPLAY for all games to 1"
echo " set STLEDITOR global \"/path\" Set the path to the STLEDITOR binary in the global config"
echo " setgameart|sga <gameid> <args> Set the artwork for various games by their AppID using absolute paths"
echo " Passing no args will open a GUI"
echo " By default, given artwork will be copied to the Steam Grid folder"
Expand Down Expand Up @@ -20767,7 +20769,12 @@ function commandline {
fi
elif [ "$1" == "set" ]; then
if [ -n "$2" ]; then
ENTLIST="$(sed -n "/#STARTsaveCfgdefault_template/,/#ENDsaveCfgdefault_template/p;/#ENDsaveCfgdefault_template/q" "$0" | grep "echo" | grep "=" | cut -d '"' -f2 | cut -d '=' -f1 | sed 's/^#//')"
if [ "$3" == "global" ]; then
ENTLIST="$(sed -n "/#STARTsaveCfgglobal/,/ENDsaveCfgglobal/p;/#ENDsaveCfgglobal/q" "$0" | grep "echo" | grep "=" | cut -d '"' -f2 | cut -d '=' -f1 | sed 's/^#//')"
else
ENTLIST="$(sed -n "/#STARTsaveCfgdefault_template/,/#ENDsaveCfgdefault_template/p;/#ENDsaveCfgdefault_template/q" "$0" | grep "echo" | grep "=" | cut -d '"' -f2 | cut -d '=' -f1 | sed 's/^#//')"
fi

if ! grep "$2" <<< "$ENTLIST" >/dev/null; then
writelog "INFO" "${FUNCNAME[0]} - '$2' is no valid entry - valid are:" "E"
writelog "INFO" "${FUNCNAME[0]} ------------------------" "E"
Expand All @@ -20792,6 +20799,10 @@ function commandline {
writelog "INFO" "${FUNCNAME[0]} - updating entry '$2' to value '$4' in config '$STLGAMEDIRID/$3.conf'" "E"
touch "$FUPDATE"
updateConfigEntry "$2" "$4" "$STLGAMEDIRID/$3.conf"
elif [ "$3" == "global" ] && [ -f "$STLDEFGLOBALCFG" ]; then
writelog "INFO" "${FUNCNAME[0]} - update global config entry '$2' to value '$3' in global config file '$STLDEFGLOBALCFG'" "E"
touch "$FUPDATE"
updateConfigEntry "$2" "$4" "$STLDEFGLOBALCFG"
else
writelog "INFO" "${FUNCNAME[0]} - config file '$STLGAMEDIRID/$3.conf' does not exist - nothing to do - exit" "E"
exit
Expand Down