fix(cli): accept negative numeric flag values#19
Conversation
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf2bf1143d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kong.Description("Search and resolve places via the Google Places API (New)."), | ||
| kong.UsageOnError(), | ||
| kong.ConfigureHelp(kong.HelpOptions{Compact: true, Summary: true}), | ||
| kong.WithHyphenPrefixedParameters(true), |
There was a problem hiding this comment.
Restrict hyphen-prefixed parsing to numeric flag values
Enabling Kong's hyphen-prefixed parameters globally affects every value-taking flag, not just numeric coordinates. When a string flag is accidentally missing its value before another flag, for example goplaces search coffee --keyword --json, Kong now consumes --json as the keyword instead of reporting the missing --keyword value, so the command proceeds with JSON disabled and sends the wrong query. Please limit the relaxed parsing to the numeric flags that need negative values, or otherwise preserve missing-value errors for following flags.
Useful? React with 👍 / 👎.
Summary
--lng -71.0972This is the maintainer rewrite of #18 because that branch does not allow maintainer edits. It preserves the original bot commit's contributor credit.
Fixes #17.
Proof
go test ./internal/cli ./cmd/goplacesgo test -race ./...The reporter's real Google API-path proof is retained on #18; this rewrite changes only argument parsing before the existing request path.