I3 [CRIT/CLI] Exit-code consistency across every parent subcommand (I4 + I23 + I27 + I36 + I44 + I46)#35
Open
espadonne wants to merge 17 commits into
Open
I3 [CRIT/CLI] Exit-code consistency across every parent subcommand (I4 + I23 + I27 + I36 + I44 + I46)#35espadonne wants to merge 17 commits into
espadonne wants to merge 17 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
CI scripts grep on exit code; pre-fix they couldn't. Pre-existing E16 + C18 patched a handful of parents (
cache,repo,issue,pr,org). The I-audit found 17 more silently exiting 0 on unknown subcommands. This PR closes the gap symmetrically.Closed:
Args: cobra.ArbitraryArgs+RunE: cmdutil.ParentRunE(). Unknown subcommand → exit 1 withunknown command "X" for "shithub Y"; run 'shithub Y --help' for usage.completion xxxxxxxxexits 1 butauth zzzzexits 0) — closes automatically once I4 closes.secret getparent has nogetsubcommand. NewLongdoc explicitly notes secrets are write-only (matches gh).shithub secret get MYnow surfacesunknown command "get" for "shithub secret". Partial caveat:shithub secret get MY -R foo/barstill showsunknown shorthand flag: 'R' in -Rbecause cobra parses flags before resolving the subcommand. Documented as known limitation; tracked separately.api -X ""(explicit empty value) used to silently default to GET. NewMethodSetfield onOptions, populated fromc.Flags().Changed("method")— distinguishes "user didn't pass -X" (default-GET, unchanged) from "user passed -X with empty value" (typo, now errors).repo create "../sneaky-name". Audit-doc reproduction was stale. The error message is still misleading (org not found) — that's I24 territory, lives in I12 bundle.Test plan
TestRunRejectsEmptyMethodFlag—api -X ""with MethodSet=true returns error mentioning-X requires a valueTestRunAcceptsUnsetMethod— default-GET path unchanged when MethodSet=falsemake ciclean across the whole tree (16 parent files touched,_devexcluded because it's behind//go:build dev)<parent> totallyunknownnow exits 1 with a useful messageshithub <whatever> badverb; echo $?reports 1 across the boardDiff shape
17 commits, one per file (one extra for the api -X "" work). Each parent gets a 3-line addition — the helper already existed (
internal/cmdutil/parent.go::ParentRunE); these PRs apply it.