GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cmd): reject unsupported --output values by pcbeingused333 · Pull Request #481 · hookdeck/hookdeck-cli

Conversation

@pcbeingused333

@pcbeingused333 pcbeingused333 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #432

Cause: the json-only --output flags were plain StringVars and each command only checked == "json", so any other value (yaml, xml, ...) fell through to the human-readable output with exit code 0.

Fix: a small outputFormatValue (pflag.Value) in pkg/cmd/output_flag.go that accepts "" and json and returns unsupported output format "yaml" (supported: json) otherwise, so cobra rejects it at parse time with a non-zero exit. The ~58 json-only --output registrations now use it (a mechanical one-line change each). listen --output (interactive/compact/quiet) is a different flag and is untouched. Help text is unchanged apart from project list, which said Output format: json and now matches the others.

Test: TestOutputFormatValue (accept/reject) and TestJSONOutputFlagsRejectUnknownFormat, which walks the whole command tree and checks that every command using the new flag value rejects yaml and accepts json. go test ./pkg/cmd/ passes, go vet and gofmt clean.

This change was prepared with AI assistance (Claude Code).

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pcbeingused333 @claude
fix(cmd): reject unsupported --output values
42f0e05
Commands with a json-only --output flag silently fell back to the
human-readable output for any other value (e.g. yaml) and exited 0.
Validate the value when the flag is parsed and name the supported one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Alex Castillo <[email protected]>
@leggetter leggetter mentioned this pull request Nov 2, 2026
ci: run build-linux on Dependabot PRs without secrets; drop the workflow_run rerun #482
Merged
@leggetter
Merge branch 'main' into fix/validate-output-flag
033e2b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Unsupported --output values are silently ignored and exit 0

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@pcbeingused333 @leggetter
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.