[PR #645] [MERGED] Cli interface #949

Closed
opened 2026-02-28 14:53:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Rigellute/spotify-tui/pull/645
Author: @OrangeFran
Created: 11/1/2020
Status: Merged
Merged: 12/30/2020
Merged by: @Rigellute

Base: masterHead: cli


📝 Commits (10+)

  • 2465263 Start implementing a cli
  • 6723ea3 Change all args to subcommands
  • 46dd07f Add new cli interface + playing track, playlist and search
  • 30c4b1f Fix .about of certain subcommands
  • d267e06 Remove forgotten println statement used for debugging
  • 8f96571 Add -f format specifier
  • 5c281b2 Change default value of status format
  • 3612374 Format code by 'cargo fmt'
  • 0f01561 Add api error handling
  • 5e215e0 Fix small bugs

📊 Changes

9 files changed (+1484 additions, -33 deletions)

View changed files

📝 README.md (+6 -1)
src/cli/clap.rs (+364 -0)
src/cli/cli_app.rs (+581 -0)
src/cli/handle.rs (+148 -0)
src/cli/mod.rs (+8 -0)
src/cli/util.rs (+259 -0)
📝 src/main.rs (+79 -28)
📝 src/network.rs (+3 -3)
📝 src/user_config.rs (+36 -1)

📄 Description

Hi there.

First of all, I know this is a lot of code. So sorry. I tried write the code as clean and as easy to understand as possible. Let me know if I can do anything to make this whole process easier for you. I actually did not have to make any architectural changes to the code base. I just use network.handle_network_event(...).await directly to query from the server.

This would implement a basic command line interface to control spotify. #429

Most of these arguments are self-explanatory. I tried my best with clap Args and ArgGroups.
What I like the most is the format option. It replaces format specifiers with their value or 'None'.
Possible specifiers are currently:

%a  -> artist
%b  -> album
%t  -> track
%p  -> playlist
%h  -> show
%u  -> uri
%s  -> status (playing or paused) (emoji)
%f  -> flags (like, repeat, shuffle) (emojis)
%v  -> volume
%d  -> current device

What needs to be done?

  • Add voume control options (done)
  • Fix --repeat bug (does not work with RepeatState::Track) (spotifyd bug)
  • Set device_id in config if wrong to first device avaible
  • Implement anyhow::Errors (done where necessary)
  • Number of search results (maybe a --offset flag?)
  • Shell completion
  • Configurable icons
  • Made for you
  • Feature requests?

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Rigellute/spotify-tui/pull/645 **Author:** [@OrangeFran](https://github.com/OrangeFran) **Created:** 11/1/2020 **Status:** ✅ Merged **Merged:** 12/30/2020 **Merged by:** [@Rigellute](https://github.com/Rigellute) **Base:** `master` ← **Head:** `cli` --- ### 📝 Commits (10+) - [`2465263`](https://github.com/Rigellute/spotify-tui/commit/2465263f2ad352c7dc128c1f946a92a61ae80408) Start implementing a cli - [`6723ea3`](https://github.com/Rigellute/spotify-tui/commit/6723ea3bfec18566e57182c64932e3c7cf4d20e0) Change all args to subcommands - [`46dd07f`](https://github.com/Rigellute/spotify-tui/commit/46dd07f05b2319ade468333027b4005a1e6449a8) Add new cli interface + playing track, playlist and search - [`30c4b1f`](https://github.com/Rigellute/spotify-tui/commit/30c4b1f13f8316385e13bb64177ec6663db41325) Fix .about of certain subcommands - [`d267e06`](https://github.com/Rigellute/spotify-tui/commit/d267e0622d26a3863b6b80268cd5010734ff314c) Remove forgotten println statement used for debugging - [`8f96571`](https://github.com/Rigellute/spotify-tui/commit/8f9657188496bc70505356b5d5ef2e2a39f6cd84) Add -f format specifier - [`5c281b2`](https://github.com/Rigellute/spotify-tui/commit/5c281b21b570f1417e4e40ce42f9fbf14bf290c7) Change default value of status format - [`3612374`](https://github.com/Rigellute/spotify-tui/commit/3612374674054a8659ad77a49b8d6b93ddc1d6dc) Format code by 'cargo fmt' - [`0f01561`](https://github.com/Rigellute/spotify-tui/commit/0f0156146d518fe9b2caf2704b7557a38b19f01b) Add api error handling - [`5e215e0`](https://github.com/Rigellute/spotify-tui/commit/5e215e0fc0ae1b3fd061a3436b22cc61debedc50) Fix small bugs ### 📊 Changes **9 files changed** (+1484 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+6 -1) ➕ `src/cli/clap.rs` (+364 -0) ➕ `src/cli/cli_app.rs` (+581 -0) ➕ `src/cli/handle.rs` (+148 -0) ➕ `src/cli/mod.rs` (+8 -0) ➕ `src/cli/util.rs` (+259 -0) 📝 `src/main.rs` (+79 -28) 📝 `src/network.rs` (+3 -3) 📝 `src/user_config.rs` (+36 -1) </details> ### 📄 Description Hi there. First of all, I know this is a lot of code. So sorry. I tried write the code as clean and as easy to understand as possible. Let me know if I can do anything to make this whole process easier for you. I actually did not have to make any architectural changes to the code base. I just use `network.handle_network_event(...).await` directly to query from the server. This would implement a basic command line interface to control spotify. #429 Most of these arguments are self-explanatory. I tried my best with clap Args and ArgGroups. What I like the most is the `format` option. It replaces format specifiers with their value or 'None'. Possible specifiers are currently: ``` %a -> artist %b -> album %t -> track %p -> playlist %h -> show %u -> uri %s -> status (playing or paused) (emoji) %f -> flags (like, repeat, shuffle) (emojis) %v -> volume %d -> current device ``` **What needs to be done?** - [x] Add voume control options (done) - [x] Fix `--repeat` bug (does not work with RepeatState::Track) (spotifyd bug) - [x] Set device_id in config if wrong to first device avaible - [x] Implement anyhow::Errors (done where necessary) - [ ] Number of search results (maybe a `--offset` flag?) - [x] Shell completion - [x] Configurable icons - [ ] Made for you * Feature requests? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:53:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#949
No description provided.