From a1164d396c54c8a7a3d17746b12c6e62816ed344 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:08:50 +0000 Subject: Refactor CLI to use subcommands for better semantics Co-authored-by: tranch <5999732+tranch@users.noreply.github.com> --- README.md | 23 ++++++++++++++---- decky_client.py | 65 +++++++++++++++++++++++++++++++++++++------------- test.sh | 2 +- user_install_script.sh | 2 +- 4 files changed, 69 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 53f0122..390f529 100644 --- a/README.md +++ b/README.md @@ -17,23 +17,38 @@ A local mirror version of the Decky Installer for Steam Deck. This repository al 2. Place the downloaded file in a convenient location on your Steam Deck. 3. Run the script or launch the desktop file to start the Decky Installer. +### Command Structure + +The `decky_client.py` script uses subcommands for different operations: + +```bash +# Install a plugin (default operation) +python3 decky_client.py install [options] + +# Configure custom store URL +python3 decky_client.py configure-store + +# Get configured store URL +python3 decky_client.py get-store +``` + ### Custom Store Configuration The installer now supports configuring custom plugin store URLs: #### Configure a Custom Store URL ```bash -python3 decky_client.py --configure-store "https://your-custom-store.com/plugins" +python3 decky_client.py configure-store "https://your-custom-store.com/plugins" ``` #### Get the Currently Configured Store URL ```bash -python3 decky_client.py --get-store +python3 decky_client.py get-store ``` #### Install from a Custom Store ```bash -python3 decky_client.py --target-id 42 --store-url "https://your-custom-store.com/plugins" +python3 decky_client.py install --target-id 42 --store-url "https://your-custom-store.com/plugins" ``` ## Mock Server for Testing @@ -47,7 +62,7 @@ python3 mock_decky_server.py --auto-confirm ### Test with the Mock Server ```bash -python3 decky_client.py --target-id 42 +python3 decky_client.py install --target-id 42 ``` The mock server implements the following Decky Loader backend routes: diff --git a/decky_client.py b/decky_client.py index 8d61f49..f1ac2b6 100644 --- a/decky_client.py +++ b/decky_client.py @@ -299,26 +299,57 @@ async def get_store_url() -> str: if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Decky Plugin Installer") - parser.add_argument("--store-url", default="http://127.0.0.1:1337/plugins", - help="Plugin store URL to fetch plugins from") - parser.add_argument("--target-id", type=int, default=42, - help="Plugin ID to install") - parser.add_argument("--configure-store", metavar="URL", - help="Configure custom store URL in Decky settings") - parser.add_argument("--get-store", action="store_true", - help="Get the configured custom store URL") + parser = argparse.ArgumentParser( + description="Decky Loader Client - Manage plugins and settings", + formatter_class=argparse.RawDescriptionHelpFormatter + ) + subparsers = parser.add_subparsers(dest="command", help="Available commands") + + # Install subcommand + install_parser = subparsers.add_parser( + "install", + help="Install a plugin from the store" + ) + install_parser.add_argument( + "--store-url", + default="http://127.0.0.1:1337/plugins", + help="Plugin store URL to fetch plugins from (default: http://127.0.0.1:1337/plugins)" + ) + install_parser.add_argument( + "--target-id", + type=int, + default=42, + help="Plugin ID to install (default: 42)" + ) + + # Configure store subcommand + config_parser = subparsers.add_parser( + "configure-store", + help="Configure custom store URL in Decky settings" + ) + config_parser.add_argument( + "url", + help="Custom store URL to configure" + ) + + # Get store subcommand + subparsers.add_parser( + "get-store", + help="Get the configured custom store URL" + ) + args = parser.parse_args() - if args.configure_store: - # Configure store URL - asyncio.run(configure_store_url(args.configure_store)) - elif args.get_store: - # Get configured store URL - asyncio.run(get_store_url()) - else: - # Run installer - only pass expected parameters + # Execute based on subcommand + if args.command == "install": asyncio.run(run_installer( target_id=args.target_id, store_url=args.store_url )) + elif args.command == "configure-store": + asyncio.run(configure_store_url(args.url)) + elif args.command == "get-store": + asyncio.run(get_store_url()) + else: + parser.print_help() + sys.exit(1) diff --git a/test.sh b/test.sh index 53b5ab6..45f6859 100755 --- a/test.sh +++ b/test.sh @@ -8,4 +8,4 @@ server_pid=$! echo "Mock Decky Server is running. Logs are being written to /tmp/mock_decky_server.log" trap "kill $server_pid" EXIT -python3 decky_client.py +python3 decky_client.py install diff --git a/user_install_script.sh b/user_install_script.sh index 49acea2..5fd1e84 100644 --- a/user_install_script.sh +++ b/user_install_script.sh @@ -37,7 +37,7 @@ fi # Download and run decky plugin installer helper (mirror-hosted). plugin_installer="/tmp/decky_client.py" if curl -fsSL "https://${DECKY_MIRROR_HOST}/AeroCore-IO/decky-installer/releases/latest/download/decky_client.py" -o "${plugin_installer}"; then - python3 "${plugin_installer}" \ + python3 "${plugin_installer}" install \ --store-url "https://${DECKY_PLUGIN_MIRROR_HOST}/plugins" \ --target-id "${DECKY_PLUGIN_TARGET_ID}" else -- cgit v1.2.3