Feat:(issue_2392) Single-value arguments can be marked as required#2393
Open
idelchi wants to merge 2 commits into
Open
Feat:(issue_2392) Single-value arguments can be marked as required#2393idelchi wants to merge 2 commits into
idelchi wants to merge 2 commits into
Conversation
idelchi
force-pushed
the
required-single-arg
branch
from
July 20, 2026 20:37
7c2cf0a to
526922f
Compare
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.
What type of PR is this?
What this PR does / why we need it:
args.go: adds aRequiredfield toArgumentBase, same as flags have. A missing required argument returnsrequired argument "name" not set.Usage()now renders optional single args as[name], matching what{Type}Argsalready does.args_test.go: addsTestSingleRequiredArgandTestChainedRequiredArgs. TheTestArgUsageexpectation for an optional arg changes fromiato[ia].docs/v3/examples/arguments/advanced.md: short section on required arguments.godoc-current.txt/testdata/godoc-v3.x.txt: regenerated.A default
Valuedoes not satisfyRequired, same as with flags.Which issue(s) this PR fixes:
Fixes #2392
Special notes for your reviewer:
The help output change (optional single args rendering as
[name]) is a separate commit and can be dropped if unwanted.Testing
go test ./...make gfmrunfor the docs examplemake generate+make v3approvefor the godoc diff checkRelease Notes