Skip to content

fix(cli): say nothing is playing in the share flags - #1075

Merged
kapok-4o merged 1 commit into
LargeModGames:mainfrom
abdul-karim-mia:fix/cli-share-nothing-playing
Nov 21, 2026
Merged

kapok-4o merged 1 commit into
LargeModGames:mainfrom
abdul-karim-mia:fix/cli-share-nothing-playing

Conversation

@abdul-karim-mia

@abdul-karim-mia abdul-karim-mia commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When nothing is playing, spotatui playback --share-album returned the error failed to generate a shareable url for the current song, which talked about a song even when sharing an album, and neither flag indicated that playback was stopped.

This change:

  • Extracts URL formatting into pure helpers track_share_url and album_share_url taking Option<&PlayableItem>.
  • In the None branch, returns clear errors stating that nothing is playing:
    • --share-track: nothing is playing, so there is no song or episode to share
    • --share-album: nothing is playing, so there is no album or show to share
  • Updates share_track_or_episode and share_album_or_show to call the helpers while preserving the single read of app.current_playback_context.
  • Adds tests track_share_url_with_nothing_playing_says_nothing_is_playing, album_share_url_with_nothing_playing_says_nothing_is_playing, and album_share_url_of_a_playing_track_is_its_album_link.
  • Corrects the typo comment // Evalute the subcommand to // Evaluate the subcommand in src/cli/handle.rs.
  • Records an entry under ### Fixed in CHANGELOG.md.

Fixes #1050.

Testing

  • cargo test --no-default-features --features telemetry,tui share_url (3 passed; 0 failed; 1928 filtered out)
  • cargo fmt --all -- --check
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings
  • cargo test --no-default-features --features telemetry,tui (1931 passed; 0 failed)
  • git diff tools/gates.count (empty, direct_playback_context_reads preserved at 87)

Additional notes

  • Errors remain standard lowercase anyhow Errs without routing through handle_error.
  • Existing URLs and other error messages are completely unchanged.
  • tools/gates.count counter is unchanged.

Summary by CodeRabbit

  • Bug Fixes
    • Share commands now clearly report that nothing is playing when used without active playback, including the album-sharing command.
    • Sharing an album while a track is playing now generates the correct album link, rather than an incorrect or mismatched link. These updates make the feedback more consistent across share options and ensure album links reflect the requested content.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CLI share methods now use URL helpers that return flag-specific errors when no item is playing. Tests cover both empty-playback errors and album URL generation from a playing track.

Changes: CLI share errors

Layer / File(s) Summary
Share URL helpers and tests
src/cli/cli_app.rs
Added helpers that generate track or episode and album or show URLs. Missing playback now returns flag-specific errors. Tests cover both errors and an album URL generated from a playing track.
CLI integration and changelog
src/cli/cli_app.rs, src/cli/handle.rs, CHANGELOG.md
The share methods pass the optional current item to the URL helpers. The changelog records the empty-playback messages. A subcommand comment spelling is corrected.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to cf895

The change makes the CLI report a clear "nothing is playing" message for the share flags when nothing is playing. Existing links are unchanged. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the conventional-commit prefix fix(cli) and matches the main change. The PR makes the share flags report a specific "nothing is playing" error when no track or album is playing, which t…
Linked Issues check Passed Issue #1050 is the only active direct link. Its coding requirements are met at the reviewed head, based on the whole-PR diff of src/cli/cli_app.rs against the merge base. Error text for track_share_ur…
Out of Scope Changes check Passed The src/cli/cli_app.rs whole-PR diff contains only work that issue #1050 requests: two pure helpers, updated async share methods, three named tests, and the imports the tests need. No TUI copy-link co…
Full details: Title check

Explanation

The title uses the conventional-commit prefix fix(cli) and matches the main change. The PR makes the share flags report a specific "nothing is playing" error when no track or album is playing, which the title describes. The title is concise and imperative, and it meets the configured title requirements.

Full details: Linked Issues check

Explanation

Issue #1050 is the only active direct link. Its coding requirements are met at the reviewed head, based on the whole-PR diff of src/cli/cli_app.rs against the merge base. Error text for track_share_url(None) and album_share_url(None) matches the issue. The old 'current song' message is removed. Both async methods read current_playback_context once and call the helpers. Existing URLs and other messages are unchanged. Errors remain Err values. The three required tests exist and use no Spotify client or network. Not directly inspected: the handle.rs comment fix, the CHANGELOG.md entry, and tools/gates.count. These rest on the PR summary. The incremental diff since the previous reviewed head could not be read.

Full details: Out of Scope Changes check

Explanation

The src/cli/cli_app.rs whole-PR diff contains only work that issue #1050 requests: two pure helpers, updated async share methods, three named tests, and the imports the tests need. No TUI copy-link code changes appear, consistent with the exclusion of #1042. The handle.rs comment fix and CHANGELOG.md entry match the issue's acceptance criteria, but were not inspected directly and rest on the PR summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Simplify code

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e5d5689 and cf8952d.

Files selected for processing: 1

  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.90476% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cli/cli_app.rs 61.9% 24 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames force-pushed the fix/cli-share-nothing-playing branch from e5d5689 to cf8952d Compare November 14, 2026 17:18
@kapok-4o
kapok-4o merged commit 7da4115 into LargeModGames:main Nov 21, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: --share-album with nothing playing says "the current song"

3 participants