Skip to content

test command help text does not document required positional arguments #446

@hazelmayank

Description

@hazelmayank

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:

  1. 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.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions