Skip to content

auth refresh subcommand: usage block dumped on success and bare 'auth' invocation #28

Description

@DTTerastar

Severity

cosmetic

Summary

Bare `withings-export auth` with no subcommand exits 0 and prints the help block to stdout (Cobra default). For a contract-driven CLI where stdout is data, this is a small stdout-pollution risk for shell-script consumers that key on `auth status` succeeding while another wrapper accidentally drops the `status`.

Reproduce

HEAD `b58068351a2edeb90f0d26b9098f04e85db225ee`.

$ /tmp/qa-bin/withings-export auth; echo \"EXIT=\$?\"
Authentication commands

Usage:
  withings-export auth [command]
...
EXIT=0

`auth bogus` correctly errors with EXIT=1, so the issue is specific to the bare-parent case.

Expected

  • `auth` with no subcommand should exit non-zero (or, at minimum, print the help block to stderr instead of stdout). The same applies to the top-level `withings-export` (no subcommand) which also exits 0. Setting `Args: cobra.NoArgs` plus a `RunE` that returns `cmd.Help()` and a non-zero exit aligns with the contract's "exit non-zero only on auth or network failure" rule for missing-arg vs success.

Severity rationale

Cosmetic: nothing breaks today, but the empty-line of stdout on a misuse can corrupt JSON pipelines.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions