Skip to content

fix(gen): stop backticks in descriptions from becoming flag types in --help - #17

Merged
rmilyushkevich merged 1 commit into
mainfrom
claude/gen-flag-help-backticks
Oct 20, 2026
Merged

rmilyushkevich merged 1 commit into
mainfrom
claude/gen-flag-help-backticks

Conversation

@rmilyushkevich

Copy link
Copy Markdown
Contributor

pflag's UnquoteUsage reads the first backticked word in a flag's usage string as its value name. Catalog descriptions use Markdown code spans, so --help printed things like --adults arrivalId and --max-price arrivalId instead of int.

buildHelp (internal/gen/main.go) now swaps backticks for single quotes. cmd/gen_*.go is regenerated against the same spec hash (f9e447f42c33). The diff touches only cmd.Flags()… usage strings and the timestamp in GENERATION_REPORT.md.

Note: the generator skips writing when the spec hash is unchanged, so I regenerated by pointing -hash-file at an empty temp file. spec-hash.txt doesn't change, so verify-generated still sees the tree as current.

Before / after (google-flights-deals --help):

--adults arrivalId     →  --adults int
--arrival-id NRT       →  --arrival-id string
--departure-id LAX     →  --departure-id string

Harness on 413f231: vet/build/test pass; --help smoke passes on 67 commands, version and completion. Command-surface diff vs main: none (flag names, types, defaults and required are unchanged). No live calls, because request building isn't touched.


Generated by Claude Code

…--help

pflag reads the first backticked word in a usage string as the flag's
value name, so descriptions like 'Requires `arrivalId`' printed
`--max-price arrivalId` instead of `--max-price int`. buildHelp now
swaps backticks for plain quotes. cmd/ is regenerated against the same
spec hash; only flag usage strings change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VkPtq7Nyd8XbgFqYQWcYfm

@rmilyushkevich rmilyushkevich left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review of 413f231. I'm leaving a COMMENT review because GitHub doesn't let this account approve its own PR.

  • internal/gen/main.go, buildHelp: this is the only hand-written change. Both buildJSONHelp and every scalar/slice/kv flag go through it, so every flag usage string is covered. Command Long text keeps its backticks, which is harmless because pflag only unquotes flag usage.
  • Generated output: every changed line in cmd/ is a cmd.Flags()… usage string. spec-hash.txt is unchanged, and CI verify-generated is green.
  • Harness: static, smoke and command-surface checks are clean; there's no surface diff.

No findings. Merging once CI is green.


Generated by Claude Code

@rmilyushkevich
rmilyushkevich merged commit 280c04e into main Oct 20, 2026
4 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.

2 participants