From 949b41eec6e90a9b6f57a2294393e8293387897b Mon Sep 17 00:00:00 2001 From: vipul Date: Sun, 3 May 2026 05:33:53 +0900 Subject: [PATCH] v1.2.3 enhance CLI help textss --- README.md | 11 ++++------ RELEASE_NOTES.md | 6 +++++- pyproject.toml | 4 ++-- src/wakemypc/main.py | 48 +++++++++++++++++++++++++++++++------------- 4 files changed, 45 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 459057b..452ecf1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Runs on your computer, talks to a Pi Pico W (or W 2) over USB, and your wakemypc ## Install -Create a virtual environment. +Create a virtual environment, if you want. ```bash python -m venv .venv ``` @@ -18,7 +18,7 @@ source .venv/bin/activate #linux/MacOS .\.venv\Scripts\Activate.ps1 #Powershell ``` -Use pip: +Use pip to install: ```bash pip install wakemypc @@ -68,11 +68,8 @@ wakemypc upload --github # 3) Configure WiFi + server. wakemypc provision --add-new-wifi --wifi-ssid HomeWiFi --wifi-pass mypassword -# 4) Register on wakemypc.com. -wakemypc register --username username --password mypassword -# or -# Use Token based registeration When using Goggle SignIn (Future versions will support login through browsers) -wakemypc register --token # Check +# 4) Register on wakemypc.com using browser login +wakemypc register --oauth --name "My Pico" ``` ## Auth Token registeration (Manual) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 05dcbeb..6c4268f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1 +1,5 @@ -## v1.2.2 — Fix OAuth workflow API links +## v1.2.3 — Patch CLI + +- Fix how CLI shows help texts for various options(Formatting) +- Add error for not passing `--name` in `register --oauth`, because API requires it. +- Bump `pyproject.toml` to 5 - Production/Stable State \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b1ddd4a..b9d9c8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "wakemypc" -version = "1.2.2" +version = "1.2.3" description = "Companion CLI for https://wakemypc.com (WakeMyPC) -- flash, provision, and manage Pico W transmitters from your terminal. WakeMyPC is a website that lets you turn on you PC remotely from anywhere in the world using Wake-on-Lan." readme = "README.md" license = { file = "LICENSE" } @@ -10,7 +10,7 @@ authors = [ ] keywords = ["wake-on-lan", "wakemypc", "raspberry-pi-pico", "iot", "homelab"] classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: End Users/Desktop", "License :: Other/Proprietary License", diff --git a/src/wakemypc/main.py b/src/wakemypc/main.py index fa7849a..e96b84b 100644 --- a/src/wakemypc/main.py +++ b/src/wakemypc/main.py @@ -520,31 +520,45 @@ def provision(server_url, wifi_ssid, wifi_pass, port, add_new_wifi, clear_wifi, Examples: First-time setup (all fields required): + wakemypc provision --add-new-wifi --wifi-ssid MyNetwork --wifi-pass secret123 Update just the server URL (keep existing WiFi): + wakemypc provision --server-url https://new-server.com - - Add a new WiFi network without removing existing ones: + + Add a new WiFi network without removing existing ones: + wakemypc provision --add-new-wifi --wifi-ssid AnotherNetwork --wifi-pass anotherpass --order 1 + wakemypc provision -a --wifi-ssid AnotherNetwork --wifi-pass anotherpass --order 1 + (The --order flag is optional but can be used to control the priority of WiFi networks) - Clear all WiFi networks and set a new one: + Clear all WiFi networks and set a new one: + wakemypc provision --clear-wifi --wifi-ssid FreshNetwork --wifi-pass freshpass + wakemypc provision -c --wifi-ssid FreshNetwork --wifi-pass freshpass - Clear all WiFi networks without adding a new one: + Clear all WiFi networks without adding a new one: + wakemypc provision --clear-wifi + wakemypc provision -c - Remove a specific WiFi network: + Remove a specific WiFi network: + wakemypc provision --remove-wifi --wifi-ssid NetworkToRemove + wakemypc provision -r --wifi-ssid NetworkToRemove Notes: + - You can run this command multiple times to update the configuration as needed. + - If you change the server URL, make sure to also update it on the server side if necessary. + - If you change WiFi credentials, the Pico will use the new ones on next boot. """ from .serial_detect import get_single_pico_port @@ -553,8 +567,7 @@ def provision(server_url, wifi_ssid, wifi_pass, port, add_new_wifi, clear_wifi, # If user runs without required args → show help instead of error if not ( - server_url - or (add_new_wifi and wifi_ssid and wifi_pass) + (add_new_wifi and wifi_ssid and wifi_pass) or clear_wifi or (remove_wifi and wifi_ssid) ): @@ -668,7 +681,7 @@ def provision(server_url, wifi_ssid, wifi_pass, port, add_new_wifi, clear_wifi, @click.option( "--oauth", is_flag=True, - default=False, + default=True, help="Sign in via the website in your browser (supports username/password and 'Sign in with Google') instead of passing --username/--password, then proceed with the normal Pico registration (or rotation, with --rotate).", ) @click.option( @@ -691,20 +704,25 @@ def register(api_url, username, password, port, name, rotate, token, oauth, no_b Modes, picked by flags: + Fresh registration via the browser (supports "Sign in with Google"): + + wakemypc register --oauth + Fresh registration with username/password: - wakemypc register --api-url https://example.com --username admin --password pass - Fresh registration via the browser (supports "Sign in with Google"): - wakemypc register --api-url https://example.com --oauth + wakemypc register --username admin --password pass Rotate an already-registered Pico's token (server invalidates the old one): - wakemypc register --api-url https://example.com --username admin --password pass --rotate - wakemypc register --api-url https://example.com --oauth --rotate + + wakemypc register --username admin --password pass --rotate + + wakemypc register --oauth --rotate Push a token you already have (no server call -- e.g. you rotated via the dashboard): + wakemypc register --token - With --oauth, the CLI opens https://example.com/dashboard/cli-auth in + With --oauth, the CLI opens https://wakemypc.com/dashboard/cli-auth in your browser, captures the JWT access token returned to a local loopback URL, and then drives the rest of the registration / rotation flow with that token -- in one go. The device_token returned by the server is @@ -746,6 +764,8 @@ def register(api_url, username, password, port, name, rotate, token, oauth, no_b # CLI only needs to know which server to talk to. if not api_url: raise click.UsageError("--api-url is required with --oauth.") + if not name: + raise click.UsageError("--name is required. Choose a friendly name, and pass as --name 'My Pico'") if username or password: click.echo( "Note: --oauth handles sign-in via the browser, so --username / "