diff options
| author | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2026-02-04 14:08:50 +0000 |
|---|---|---|
| committer | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2026-02-04 14:08:50 +0000 |
| commit | a1164d396c54c8a7a3d17746b12c6e62816ed344 (patch) | |
| tree | 47e9ce27bd46ec2c4ee57fa7dae21b5f63d8699d | |
| parent | 06d1b194d4ce46524bc03628ecdf15fa2e135e5f (diff) | |
| download | decky-installer-a1164d396c54c8a7a3d17746b12c6e62816ed344.tar.gz decky-installer-a1164d396c54c8a7a3d17746b12c6e62816ed344.zip | |
Refactor CLI to use subcommands for better semantics
Co-authored-by: tranch <5999732+tranch@users.noreply.github.com>
| -rw-r--r-- | README.md | 23 | ||||
| -rw-r--r-- | decky_client.py | 65 | ||||
| -rwxr-xr-x | test.sh | 2 | ||||
| -rw-r--r-- | user_install_script.sh | 2 |
4 files changed, 69 insertions, 23 deletions
@@ -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 <url> + +# 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) @@ -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 |
