Repository navigation
fix(cli): pluralize "argument" in argument-count errors - #2161
Merged
TerryHowe merged 1 commit intoSep 8, 2026
Merged
Conversation
Exactly and AtLeast hardcode the singular noun, so every command that
requires more than one argument reports a count that does not agree with
it:
$ oras cp foo
Error: "oras cp" requires exactly 2 argument but got 1
Please specify exactly 2 argument as the source and destination for
copying. Run "oras cp -h" for more options and examples
The text appears twice per failure, since errors.CheckArgs uses the same
string in both the error and the recommendation. It reaches users of
`oras cp` and `oras blob push`, which are the commands taking exactly 2
arguments.
docs/proposals/error-handling-guideline.md already specifies the plural
form as the intended wording:
Error: "oras copy" requires exactly 2 arguments but received 0.
so this brings the implementation in line with the documented guideline.
Counts of 1 keep the singular, and 0 reads "exactly 0 arguments".
Also add tests for this package, which had no test file. They cover both
checkers over counts 0 through 2, asserting the boolean result and the
exact message, and take the package from 0% to 100% statement coverage.
Signed-off-by: Akshita <[email protected]>
akshita317
requested review from
TerryHowe,
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
September 8, 2026 17:11
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2161 +/- ##
=======================================
Coverage 87.66% 87.67%
=======================================
Files 139 139
Lines 5685 5689 +4
=======================================
+ Hits 4984 4988 +4
Misses 418 418
Partials 283 283 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
ExactlyandAtLeasthardcode the singular noun, so any command requiring more than one argument reports a count that disagrees with it:The text appears twice per failure, since
errors.CheckArgsreuses the same string in both the error and the recommendation. It affectsoras cpandoras blob push, the commands taking exactly 2 arguments.Why this wording
docs/proposals/error-handling-guideline.mdalready specifies the plural form as the intended output:So this is the implementation catching up with the documented guideline, not a new style choice.
After
A count of 0 reads "exactly 0 arguments", which matches ordinary English usage.
Tests
This package had no test file (0% statement coverage). Added table-driven tests covering both checkers across counts 0–2, asserting the boolean result and the exact message. The package is now at 100% statement coverage.
Nothing in the repo asserts on the old string — no e2e suite or unit test matches
requires exactly/at least ... argument— so no other tests needed updating.go test ./...,gofmtandgo vetare clean.