Repository navigation
fix(cli): name the missing argument in usage errors (#32) - #34
Merged
Merged
Conversation
`ucmix ls scenes` failed with cobra's bare "accepts 1 arg(s), received 0", which never says what the argument is. Since `ls projects` takes none, it read as though `ls scenes` should list everything. requireArgs wraps a cobra positional-arg validator and turns a wrong count into an errs.CLIError that names what the command wants, with a hint pointing at how to find the value (falling back to the command's usage line). Applied to every command that validates positional args. Claude-Session: https://claude.ai/code/session_01Ggvmi2jXGiS5ffLr7Hfn6d
steveclarke
force-pushed
the
32-ls-scenes-usage
branch
from
July 25, 2026 18:28
ef0f00e to
405ee30
Compare
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.
Closes #32.
ucmix ls scenesfailed with✗ accepts 1 arg(s), received 0— cobra's bare count message, which never says what the argument is. Sincels projectstakes none, it read as thoughls scenesshould list everything.Now:
The quoting note earns its place: real project names look like
03.135 Main Live.proj, so the common failure is a forgotten quote, not an omitted argument. Unquoted, cobra sees three args and the same message fires — the hint has to cover both.How
requireArgs(internal/cli/args.go) wraps acobra.PositionalArgsvalidator and turns a wrong count into anerrs.CLIErrornaming what the command wants, plus a hint pointing at how to find the value. When there's nothing better to say the hint falls back to the command's usage line:Applied to every command that validates positional args:
ls scenes,recall,store,rename,delete,channel,mix,send,get,fade,apply,verify,dump, and theprofilesubcommands.setusesArbitraryArgsand never errors, so it's untouched.Not done deliberately
ls scenes. The issue left that open; this stays a usage-message fix.Known limitation, pre-existing
--no-coloris not honored on the arg-validation path:ui.Initruns inPersistentPreRun, which cobra skips whenArgsvalidation fails, soucmix --no-color ls scenesstill emits ANSI.NO_COLOR=1does work (the package-level initializer reads it). This predates the change — cobra's bare message was styled too — but this PR adds a second styled line there, so it's worth naming. Fixing it means restructuringExecute(), out of scope here.Testing
just test— 378 unit (was 373); table-drivenTestRequireArgscovers valid counts, too few, too many, and the usage-line fallback (including that cobra's[flags]suffix is trimmed).just test-e2e— 75 BATS (was 72); new cases intest/errors.batsforls sceneswith no project,get/recallmissing args, and the usage-line fallback.just lint,just vetclean.studiolive32r), read-only — nothing was written:ls projects,ls scenes "03.135 Main Live.proj",get line/ch1/mute,dump line/ch1, and--jsonoutput all still work. Also confirmed the arg errors forstore,rename,delete,apply, andfadefire with the live profile current and exit non-zero without contacting the board, and that the unquotedls scenes 03.135 Main Live.projcase produces the message above.https://claude.ai/code/session_01Ggvmi2jXGiS5ffLr7Hfn6d