Skip to content

fix(cli): accept negative numeric flag values#19

Merged
steipete merged 1 commit into
mainfrom
fix/negative-numeric-flags
Jul 4, 2026
Merged

fix(cli): accept negative numeric flag values#19
steipete merged 1 commit into
mainfrom
fix/negative-numeric-flags

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • accept space-separated negative numeric values such as --lng -71.0972
  • use Kong's supported hyphen-prefixed-parameter mode instead of maintaining a CLI flag allowlist
  • cover search, autocomplete, nearby, and directions request payloads
  • add the user-visible fix to the changelog

This 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/goplaces
  • go test -race ./...
  • source-blind standalone-binary contract: space-separated search longitude, four negative directions coordinates, equals syntax, unknown flag, and missing numeric value all passed
  • request bodies observed through a mock Places/Routes API contained the expected negative numeric values
  • AutoReview completed without actionable findings
  • public model identifier gate: PASS (no model-bearing code or artifacts)

The reporter's real Google API-path proof is retained on #18; this rewrite changes only argument parsing before the existing request path.

Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
@steipete
steipete merged commit 1d0fd5c into main Jul 4, 2026
4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread internal/cli/run.go
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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@steipete
steipete deleted the fix/negative-numeric-flags branch July 4, 2026 05:08
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.

--lng (and any negative numeric flag) misparsed as a new flag in space-separated form

1 participant