Skip to content

CLI: a mistyped subcommand (e.g. dataset pus) prints help and exits 0 instead of erroring #75

@saadqbal

Description

@saadqbal

Severity: LOW (scriptability/correctness). Found during the #67 stress sweep.

Repro

tracebloc dataset pus ./mydata   # typo for "push"
echo $?                          # → 0

Output is the dataset group help, exit code 0. A script that typos a subcommand (psuh, lst, remove) gets a success exit and no error, so the mistake passes silently in CI.

Root cause

Cobra default: an unknown token under a parent command with no Run is treated as an arg and the parent prints help with exit 0. Other parsing errors (unknown flag, too many args) correctly exit non-zero — this is the one gap.

Expected

Unknown subcommand → stderr Error: unknown command "pus" for "tracebloc dataset" (Cobra suggests the nearest match) and a non-zero exit. Typically SuggestionsMinimumDistance + ensuring the parent returns an error on unknown subcommands.

Part of #67.

Metadata

Metadata

Assignees

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