Skip to content

v1.0.3

Choose a tag to compare

@JiangHe12 JiangHe12 released this 08 Jun 01:23

fix(apperrors): classify Cobra MinimumNArgs usage errors as USAGE_ERROR (exit 1)

isCobraParserError did not recognize the requires at least N arg(s), only received M message emitted by cobra.MinimumNArgs / cobra.RangeArgs. Such usage errors fell through AsAppError to LOCAL_IO_ERROR (exit 6) instead of USAGE_ERROR (exit 1).

Preventive engine hardening: no CLI in the family currently uses those validators, so there was no live exposure — but the gap would have silently broken the exit-code contract the day any command adopted them.

  • Add the requires at least prefix to the Cobra-parser-error heuristic.
  • Table-driven test asserting both the error code and exit code 1.