Description
microcks test --help advertises the command's flags, but does not document
the three required positional arguments. A new user reading --help has no
indication that the command needs <apiName:apiVersion> <testEndpoint> <runner>.
Reproduction
$ microcks test --help
Run tests on Microcks
Usage:
microcks test [flags]
Flags:
--filteredOperations string List of operations to launch a test for
...
Current behavior on missing args
The required-args contract is only discoverable by running the command with
no args and reading the error message printed by the manual check at
cmd/test.go:51:
test command require <apiName:apiVersion> <testEndpoint> <runner> args
This is a UX gap — the help text should be self-sufficient. It also means
the docs generated under documentation/cmd/test.md lack the same info.
Proposed fix
Two changes in cmd/test.go:
-
Document the args in Cobra metadata.
- Update
Use: to test <apiName:apiVersion> <testEndpoint> <runner>.
- Expand
Long: to describe each required argument.
- Add an
Example: block showing a realistic invocation.
-
Use Cobra's declarative arg validator.
- Set
Args: cobra.ExactArgs(3) on the command. Cobra rejects calls with
the wrong number of positional args automatically and prints the usage
hint, giving better UX than the current manual check.
- Remove the now-redundant
if len(os.Args) < 4 { ... } block in Run.
No change to flags, server interaction, or exit-code semantics. The
per-argument checks for empty / dash-prefixed values are kept for defense.
Environment
- Branch:
master (development version 1.0.3)
- File:
cmd/test.go
Description
microcks test --helpadvertises the command's flags, but does not documentthe three required positional arguments. A new user reading
--helphas noindication that the command needs
<apiName:apiVersion> <testEndpoint> <runner>.Reproduction
Current behavior on missing args
The required-args contract is only discoverable by running the command with
no args and reading the error message printed by the manual check at
cmd/test.go:51:This is a UX gap — the help text should be self-sufficient. It also means
the docs generated under
documentation/cmd/test.mdlack the same info.Proposed fix
Two changes in
cmd/test.go:Document the args in Cobra metadata.
Use:totest <apiName:apiVersion> <testEndpoint> <runner>.Long:to describe each required argument.Example:block showing a realistic invocation.Use Cobra's declarative arg validator.
Args: cobra.ExactArgs(3)on the command. Cobra rejects calls withthe wrong number of positional args automatically and prints the usage
hint, giving better UX than the current manual check.
if len(os.Args) < 4 { ... }block inRun.No change to flags, server interaction, or exit-code semantics. The
per-argument checks for empty / dash-prefixed values are kept for defense.
Environment
master(development version1.0.3)cmd/test.go