Skip to content

feat: CLI v2 Phase 3 — help shortcut, NO_COLOR, README polish#14

Merged
luongnv89 merged 2 commits intomainfrom
feat/11-cli-v2-phase3-polish
Apr 4, 2026
Merged

feat: CLI v2 Phase 3 — help shortcut, NO_COLOR, README polish#14
luongnv89 merged 2 commits intomainfrom
feat/11-cli-v2-phase3-polish

Conversation

@luongnv89
Copy link
Copy Markdown
Owner

Summary

Closes #11

Final polish for CLI v2 reorganization (Phase 3 of 3):

  • Task 3.1 — README rewrite: All examples now use mc as the primary command. Replaced the flat command table with the full new command tree. Added a migration guide table for existing users upgrading from v1 syntax. Noted that music-cli still works as the full command name.
  • Task 3.2 — NO_COLOR support: Added --no-color global flag and NO_COLOR environment variable support per no-color.org. Created an icon() helper that swaps unicode emoji for plain-text fallbacks (e.g. becomes [playing], becomes [stopped]). All emoji usage in CLI output goes through this helper.
  • Task 3.3 — -h help shortcut: Set context_settings=dict(help_option_names=["-h", "--help"]) on the main group, which propagates to all subcommands. mc -h, mc play -h, mc radio -h etc. all show help.

Files changed

File Changes
music_cli/cli.py Added icon(), _is_no_color(), _ICON_FALLBACKS; added --no-color flag; set context_settings for -h; updated all emoji output to use icon()
README.md Rewrote command examples to use mc; replaced command table with tree; added migration guide section
tests/test_cli.py Added 56 new tests for -h shortcut, --no-color flag, NO_COLOR env var, icon() helper

Test plan

  • All 140 tests pass (84 existing + 56 new)
  • mc -h shows help at main level
  • -h works for all subcommands (play, radio, ai, history, etc.)
  • -h output matches --help output exactly
  • mc --no-color status shows [playing] instead of
  • NO_COLOR=1 mc status shows text fallbacks
  • NO_COLOR='' mc status keeps emoji (empty string does not activate)
  • --no-color suppresses emoji for stop, pause, resume, next, play commands
  • icon() helper returns symbol by default, fallback when no-color active
  • --no-color appears in mc --help output
  • README uses mc as primary command in all examples

… v2 Phase 3)

- Add -h as help shortcut at every command level via context_settings
- Add --no-color flag and NO_COLOR env var support (per no-color.org)
- Create icon() helper to swap emoji for text fallbacks when no-color active
- Rewrite README with new mc command tree, migration guide, and mc-first examples
- Add 56 new tests covering all Phase 3 functionality
If ctx.obj is None (e.g. subcommand invoked without the main group
calling ensure_object), ctx.obj.get() would raise AttributeError.
Now falls back to the NO_COLOR env var check in that case.
@luongnv89 luongnv89 merged commit 7a63061 into main Apr 4, 2026
12 of 14 checks passed
@luongnv89 luongnv89 deleted the feat/11-cli-v2-phase3-polish branch April 4, 2026 23:18
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 v2 Phase 3: Polish — README, help shortcut, no-color support

1 participant