Refactor CLI to use subcommands for utility functions - #215
Merged
Merged
Conversation
Move --list-audio-devices, --list-servers, and --list-clients from player flags to their own subcommand namespaces: - sendspin audio-devices list - sendspin servers list - sendspin clients list The old flags are kept as deprecated with a warning message pointing to the new commands. This also fixes #207 where --list-audio-devices was not recognized under the daemon subcommand - now it's a top-level subcommand accessible from anywhere. Closes #207 https://claude.ai/code/session_018Mj2pQj7Lqu5YTGnB97E94
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the sendspin CLI to introduce dedicated utility subcommands for listing audio devices, servers, and clients, while keeping the previous flag-based entry points working with deprecation warnings for backward compatibility.
Changes:
- Added new top-level subcommands:
audio-devices list,servers list, andclients list. - Kept legacy flags (
--list-audio-devices,--list-servers,--list-clients) but updated help text and added deprecation warnings/routing. - Updated docs and the systemd install script to use the new subcommand syntax.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sendspin/cli.py | Adds new subcommand parsers and dispatch logic; updates help text and legacy flag behavior. |
| scripts/systemd/install-systemd.sh | Switches device listing invocation to audio-devices list. |
| README.md | Updates usage examples to the new subcommand syntax. |
| AGENTS.md | Updates internal documentation to reflect the new command forms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use required=True on subparsers so argparse gives a proper error with non-zero exit when the subcommand is missing, removing unreachable fallback code that called parse_args(["...", "--help"]) (which raised SystemExit before return 1 could run) - Replace fragile head -n -2 in install-systemd.sh with pattern-based grep filtering to reliably strip guidance lines regardless of format - Clarify README wording about ALSA plugin devices: they may not appear in the numbered PortAudio list but can appear in the ALSA section Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
selleronom
pushed a commit
to selleronom/sendspin-cli
that referenced
this pull request
Apr 15, 2026
## Summary Refactored the CLI to introduce dedicated subcommands (`audio-devices`, `servers`, `clients`) for utility functions, replacing the previous flag-based approach (`--list-audio-devices`, `--list-servers`, `--list-clients`). The old flags are deprecated but remain functional with warnings for backward compatibility. ## Key Changes - **New subcommand structure**: Added three new top-level subcommands with `list` subcommands: - `sendspin audio-devices list` (replaces `--list-audio-devices`) - `sendspin servers list` (replaces `--list-servers`) - `sendspin clients list` (replaces `--list-clients`) - **Parser updates**: - Added `audio-devices`, `servers`, and `clients` to `EXPLICIT_APPS` frozenset - Created dedicated argument parsers for each new subcommand with appropriate help text - Added routing logic in `main()` to handle the new subcommands - **Backward compatibility**: - Deprecated flags still work but now print a warning message directing users to the new subcommands - Old flags remain in the player argument parser with updated help text indicating deprecation - **Documentation updates**: - Updated help text throughout to reference new subcommand syntax - Updated README.md examples to use new subcommand format - Updated AGENTS.md to reflect new device enumeration approach - Updated systemd installation script to use new subcommand syntax - Added example output showing both old and new syntax in `list_audio_devices()` ## Implementation Details - New subcommands are handled before the main player/daemon/serve logic in `main()` - Each new subcommand validates that a `list` subcommand was provided; otherwise shows help - Deprecation warnings are printed to stdout when old flags are used - All three new subcommands follow the same pattern for consistency and extensibility https://claude.ai/code/session_018Mj2pQj7Lqu5YTGnB97E94 --------- Co-authored-by: Claude <[email protected]>
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
Refactored the CLI to introduce dedicated subcommands (
audio-devices,servers,clients) for utility functions, replacing the previous flag-based approach (--list-audio-devices,--list-servers,--list-clients). The old flags are deprecated but remain functional with warnings for backward compatibility.Key Changes
New subcommand structure: Added three new top-level subcommands with
listsubcommands:sendspin audio-devices list(replaces--list-audio-devices)sendspin servers list(replaces--list-servers)sendspin clients list(replaces--list-clients)Parser updates:
audio-devices,servers, andclientstoEXPLICIT_APPSfrozensetmain()to handle the new subcommandsBackward compatibility:
Documentation updates:
list_audio_devices()Implementation Details
main()listsubcommand was provided; otherwise shows helphttps://claude.ai/code/session_018Mj2pQj7Lqu5YTGnB97E94