Skip to content

Refactor CLI to use subcommands for utility functions - #215

Merged
balloob merged 2 commits into
mainfrom
claude/move-audio-flags-cli-tqtE6
Apr 10, 2026
Merged

balloob merged 2 commits into
mainfrom
claude/move-audio-flags-cli-tqtE6

Conversation

@balloob

@balloob balloob commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

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

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
Copilot AI review requested due to automatic review settings April 9, 2026 22:17
@balloob balloob added the breaking-change Breaks API or changes the protocol in a not backwards compatible way label Apr 9, 2026
@balloob balloob linked an issue Apr 9, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and clients 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.

Comment thread sendspin/cli.py Outdated
Comment thread sendspin/cli.py Outdated
Comment thread sendspin/cli.py Outdated
Comment thread scripts/systemd/install-systemd.sh Outdated
Comment thread README.md Outdated
- 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]>
@balloob
balloob merged commit dd81dfd into main Apr 10, 2026
1 check passed
@balloob
balloob deleted the claude/move-audio-flags-cli-tqtE6 branch April 10, 2026 11:42
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Breaks API or changes the protocol in a not backwards compatible way

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daemon: error: unrecognized arguments: --list-audio-devices

3 participants