CLI support, settings persistence, and project restructuring - #4
Open
martesi wants to merge 15 commits into
Open
CLI support, settings persistence, and project restructuring#4martesi wants to merge 15 commits into
martesi wants to merge 15 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a dual-mode CLI/GUI tool (
hd2-repatcher/hd2-repatcher-cli), decouples the patching engine from Tkinter, adds persistent game-data-path caching, and sets up packaging, CI, and a release pipeline.Features introduced
cli.py):hd2-repatcher-cli --game <path> <PATCH_FOLDER> [<PATCH_FOLDER> ...]processes one or more mod folders non-interactively and reports results to stdout/stderr, with a non-zero exit code if any patch file is corrupted. Falls back to the GUI when invoked with no arguments.settings.py): the selected gamedatafolder is persisted to%LOCALAPPDATA%\hd2-repatcher\settings.json(viaplatformdirs), so-g/--gameonly needs to be passed once.--no-game-path-cachingopts a given-ginvocation out of overwriting the cache — useful for mod-manager integrations that always want to pass the path explicitly.hd2-repatcher-cli.exeruns the CLI path with the cached game path, and the process pauses with "Press Enter to exit..." (pause_if_owns_consoleincli.py) so the auto-spawned console window doesn't disappear before the result can be read.pyproject.toml:pip install -e .now installs bothhd2-repatcherandhd2-repatcher-cliconsole-script entry points;requirements.txtis removed in favor of declared dependencies (lz4,platformdirs) plustest/buildextras.build.ps1) automating the two-exe PyInstaller build..github/workflows/test.ymlrunspyteston every push/PR (windows-latest);.github/workflows/release.ymlbuilds both executables and drafts a GitHub release with them attached on tag push or manual dispatch.tests/): added tests covering features added in this PR.Behavior changes
sys.exit.update_unit_mods.pylost its module-level Tk root,select_folder/select_data_folder(moved togui.py), and the top-levelwhile Trueloop.process_patch_folder(directory) -> PatchResultreplaces the oldupdate_all()/messagebox-driven flow, returning a structured dataclass (patches_found,updated,no_units,corrupted_files) instead of talking to Tkinter directly —gui.pyandcli.pyeach render it their own way.is_valid_game_data_path()replaces the inlineos.path.exists(...) and ...checks and now also confirms the path is a directory (os.path.isdir) before checking for the marker files (9ba626afa44a3aa3/bundles.nxa).init_game_resources(path)replaces the ad hocslim_init(...)/load_game_resources()pairing that used to be inlined in the GUI loop.Caveat: two executables
The original building produces an executable without an extra console window; however, that also stops the CLI from functioning as intended. If the extra window doesn't cause much hassle for others, we could remove the old build and keep CLI only.