Skip to content

Instantly share code, notes, and snippets.

@BinToss
Created April 24, 2026 09:22
Show Gist options
  • Select an option

  • Save BinToss/df9fb77532f8364bc558cefcbd5aac66 to your computer and use it in GitHub Desktop.

Select an option

Save BinToss/df9fb77532f8364bc558cefcbd5aac66 to your computer and use it in GitHub Desktop.
rustique_outdated is a wrapper for Rustique mod manager that lists which installed mods may be incompatible with a given version of Vintage Story.
#!/bin/fish
# INSTALL: cp rustique_outdated.fish ~/.config/fish/functions/
set -l desc "rustique_outdated is a wrapper for Rustique mod manager that lists which installed mods may be incompatible with a given version of Vintage Story."
set -l desc_help "Print help"
set -l desc_mods_dir "(Optional) Specify the directory to manage mods. Defaults to Rustique's mod_dir."
set -l desc_game_version "(Optional) Specify the game version to manage. MAJOR.MINOR format is recommended e.g. '1.22'. Defaults to Rustique's pinned_game_version."
complete -c rustique_outdated -s h -l help -d "$desc_help"
complete -c rustique_outdated -s m -l mods-dir -d "$desc_mods_dir"
complete -c rustique_outdated -s g -l game-version -d "$desc_game_version"
function rustique_outdated
argparse -S h/help 'm/mods-dir=!test' 'g/game-version=' -- $argv
or return
# -h/--help
if set -ql _flag_h
echo "$desc
$(set_color -u brblue && echo -n "Usage:" && set_color --reset brblue && echo -n " rustique_outdated" && set_color --reset) [OPTIONS]
$(set_color -ub brblue && echo -n "Options:" && set_color --reset brblue && set_color brblue)
-m$(set_color --reset), $(set_color brblue)--mods-dir <MODS_DIR>$(set_color --reset) $desc_mods_dir
-g$(set_color --reset), $(set_color brblue)--game-version <GAME_VERSION>$(set_color --reset) $desc_game_version
-h$(set_color --reset), $(set_color brblue)--help$(set_color --reset) $desc_help
"
end
set -l errorOccurred 0
# ensure JQ is available to process JSON files
if not [ -e $(which jq) ]
echo "This function requires `jq` to work!"
set errorOccurred 1
end
# ensure Grep is available to process other files
if not [ -e $(which grep) ]
echo "This function requires Grep to process non-JSON files!"
set errorOccurred 1
end
[ $errorOccurred -gt 0 ] && return 1
# cache the output of `rustique config list` so it is never executed more than once if at all.
set -l rustiqueConfigList ''
function __get_rustique_config_list
[ -z "$rustiqueConfigList" ] || set rustiqueConfigList "$(rustique config list)"
echo "$rustiqueConfigList"
end
# -m/--mods-dir
set -l mods_dir ''
set -ql _flag_m
and set mods_dir $_flag_m[1]
or set mods_dir $(grep -oP '(?<=mod_dir)' ~/.config/rustique/config.toml)
or set mods_dir $(__get_rustique_config_list | grep -oP '(?<=mod_dir).+(?=│$)' | string trim)
not [ -d mods_dir ]
and set_color brred && echo 'Mods directory not found or not a directory!' && return 1
# -g/--game-version
set -l game_version ''
set -ql _flag_g
and set game_version $_flag_g[1]
or set -l game_version $(grep -oP '(?<=pinned_game_version = ").+(?="$)' ~/.config/rustique/config.toml)
or set -la game_version $(__get_rustique_config_list | grep -oP '(?<=pinned_game_version).+(?=│$)' | string trim)
not echo $game_version | grep -Pq '\d+\.\d+'
and set_color brred && echo 'No game version specified!' && return 1
set -l syncFile "$mods_dir/rustique-sync.json"
set -l outdatedFile "$mods_dir/rustique-outdated.json"
# Process rustique-sync.json for mods which don't declare compatibility with $game_version
set -l output "$(
jq -rS -- "
[
.RustiqueSync as \$rs |
\$rs |
keys[] as \$k |
\$rs.[\$k] |
{ mod_id: \$k, mod_name, file_name, installed_version, latest_known_version, game_versions}
] |
map(
select(
.game_versions |
all( contains(\"$game-version\") | not )
)
)
" $syncFile
)"
[ "$status" != 0 ]
and return $status
or echo $output |
# write detailed json output to rustique-outdated.json
tee $outdatedFile |
jq -rS -- '.[] | .mod_id'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment