feat: CLI v2 Phase 3 — help shortcut, NO_COLOR, README polish#14
Merged
feat: CLI v2 Phase 3 — help shortcut, NO_COLOR, README polish#14
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #11
Final polish for CLI v2 reorganization (Phase 3 of 3):
mcas 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 thatmusic-clistill works as the full command name.--no-colorglobal flag andNO_COLORenvironment variable support per no-color.org. Created anicon()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.-hhelp shortcut: Setcontext_settings=dict(help_option_names=["-h", "--help"])on the main group, which propagates to all subcommands.mc -h,mc play -h,mc radio -hetc. all show help.Files changed
music_cli/cli.pyicon(),_is_no_color(),_ICON_FALLBACKS; added--no-colorflag; setcontext_settingsfor-h; updated all emoji output to useicon()README.mdmc; replaced command table with tree; added migration guide sectiontests/test_cli.py-hshortcut,--no-colorflag,NO_COLORenv var,icon()helperTest plan
mc -hshows help at main level-hworks for all subcommands (play,radio,ai,history, etc.)-houtput matches--helpoutput exactlymc --no-color statusshows[playing]instead of▶NO_COLOR=1 mc statusshows text fallbacksNO_COLOR='' mc statuskeeps emoji (empty string does not activate)--no-colorsuppresses emoji for stop, pause, resume, next, play commandsicon()helper returns symbol by default, fallback when no-color active--no-colorappears inmc --helpoutputmcas primary command in all examples