Skip to content

On error, cobra usage/flags text is dumped to stderr (clutters logs and fails the 'data only on stdout, errors only on stderr' contract) #31

@DTTerastar

Description

@DTTerastar

Command

```
liftoff-export workouts list --format csv
```

Actual (stderr)

```
Error: unknown --format "csv" (use markdown or json)
Usage:
liftoff-export workouts list [flags]

Flags:
--exercise string Filter to exercises matching this name (word-prefix match)
--format string Output format: markdown (default, fitdown-style) or json (default "markdown")
-h, --help help for list
--since string Filter workouts on or after date ...
--until string Filter workouts through date, inclusive ...
```

Expected

Just the error line. The cobra default `SilenceUsage: true` should be set on every `RunE` command so usage is only printed on `--help`, not on every runtime error. Reproduces with any error: bad date, bad format, even the deprecated-API 403.

Severity

minor

Metadata

Metadata

Assignees

Labels

area:format--format markdown/json/csv and codec behavior.kind:bugObserved behavior diverges from documented behavior.priority:mediumReproducible bug or gap with a workaround, or a well-scoped enhancement clearly in charter.

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