diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-02 13:35:56 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-02 13:35:56 +0100 |
| commit | 5dfb5b4ce521a44eb4e9173d20c58e665c78e979 (patch) | |
| tree | 514508f9bef90444b867a68abfeb2ad365c44d14 /src/cli.rs | |
| parent | audio: open the output at the track's rate instead of pw-alsa's 44100 (diff) | |
| download | rsplayer-5dfb5b4ce521a44eb4e9173d20c58e665c78e979.tar.gz rsplayer-5dfb5b4ce521a44eb4e9173d20c58e665c78e979.zip | |
ctl: interactive shell with history, editing and completion
`rsp ctl` opens a prompt in the spirit of bluetoothctl. Lines are parsed with
the same clap definitions as the one-shot CLI, so every command and flag works
exactly as it does from a terminal, `help <command>` included.
Tab completes subcommands, and track/album/artist paths for `play` through
`db-complete` (run out of process, keeping its 100 ms timeout away from the
input loop). History lives in the state directory. Piped input falls back to a
plain line loop, so `rsp ctl < commands` works without a terminal.
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 5 |
1 files changed, 5 insertions, 0 deletions
| @@ -104,6 +104,8 @@ pub enum Commands { | |||
| 104 | }, | 104 | }, |
| 105 | /// display lyrics | 105 | /// display lyrics |
| 106 | Lyrics, | 106 | Lyrics, |
| 107 | /// Interactive control shell (like bluetoothctl) | ||
| 108 | Ctl, | ||
| 107 | } | 109 | } |
| 108 | 110 | ||
| 109 | #[derive(Subcommand)] | 111 | #[derive(Subcommand)] |
| @@ -350,6 +352,9 @@ impl Cli { | |||
| 350 | Commands::Lyrics => { | 352 | Commands::Lyrics => { |
| 351 | let _ = crate::daemon::send_command("lyrics".to_string()); | 353 | let _ = crate::daemon::send_command("lyrics".to_string()); |
| 352 | } | 354 | } |
| 355 | Commands::Ctl => { | ||
| 356 | crate::ctl::run()?; | ||
| 357 | } | ||
| 353 | } | 358 | } |
| 354 | Ok(()) | 359 | Ok(()) |
| 355 | } | 360 | } |
