Skip to content

cut: declare required positionals through cli arguments - #136

Merged
CMGS merged 1 commit into
masterfrom
cut/positional-args
Sep 9, 2026
Merged

cut: declare required positionals through cli arguments#136
CMGS merged 1 commit into
masterfrom
cut/positional-args

Conversation

@CMGS

@CMGS CMGS commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

What

Seventeen commands checked their positional argument by hand and returned their own "must be given" error. They now declare it: utils.Positional(name, usage, max) builds a required cli.StringArgs (urfave/cli v3.11 carries Min/Max on the plural type only; max −1 is an id list), 27 commands use it, the actions read cmd.StringArgs(name) and the argIDs helper is gone.

Kept as they were: image build (its rule is exactly one argument, and a declared argument ignores extras) and workload dissociate (ids are optional when --node is given).

Behaviour change

A missing argument now fails before the action with urfave's message, printed through the logger with exit code 1, where it used to be a bare line with exit code 255:

$ eru-cli pod nodes
FTL run eru-cli error="sufficient count of arg pod not provided, given 0 expected 1" func=main.main
$ eru-cli pod nodes --help
USAGE:
   eru-cli pod nodes [options] pod name

Lines

Production −128 net (+63 −191), tests +8 net; comment delta +1 −0 (the helper's godoc carries the −1 convention).

Evidence

Gate on the branch: build, vet, full tests, make lint, make fmt-check and asl on both GOOS green; the two tests that pinned the old errors now assert the run fails before the action.

Seventeen commands checked their positional by hand and returned their
own "must be given" error. They now declare it through
utils.Positional (a required cli.StringArgs, max -1 for an id list),
so urfave rejects the run before the action; the argIDs helper goes
with them. The missing-argument failure is now the framework's message
through the logger with exit code 1 instead of a bare line with 255.
image build keeps its exactly-one check (a declared argument ignores
extras) and workload dissociate keeps its optional ids.
@CMGS
CMGS merged commit 779ae0b into master Sep 9, 2026
3 checks passed
@CMGS
CMGS deleted the cut/positional-args branch September 9, 2026 10:03
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.

1 participant