Print help that was asked for to stdout (closes #179)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
--help, -h and the help subcommand now print to stdout and exit 0, so the help text can be paged and searched. The usage text of a usage error stays on stderr with exit 2. Cobra prints both through the command's output writer, which stays stderr; the help function points it at stdout before printing. README "Settings" and goal 4 say so, and the help tests read stdout. Model: opus-5-5
This commit is contained in:
1 parent
e16c46804d
commit
82277f84bd
5 files changed
+59
-39
No files matched your search
@@ -255,6 +255,7 @@ In order:
|
||||
time, against what the database holds.
|
||||
4. **Keep the streams apart.** Everything on stdout is machine-readable data.
|
||||
Everything for a human reader, such as progress and warnings, goes to stderr.
|
||||
The one exception is help that was asked for, which goes to stdout.
|
||||
|
||||
### Subcommands
|
||||
|
||||
@@ -324,12 +325,13 @@ The reference below is also the program's specification.
|
||||
"Operands").
|
||||
- `--version`, `-v` prints `sfdupes VERSION` (see "Install") to stdout and
|
||||
exits 0. It writes nothing to stderr.
|
||||
- `--help`, `-h`, alone or after a subcommand, prints the help text to stderr
|
||||
and exits 0. It writes nothing to stdout. The help of `sfdupes` and of `scan`
|
||||
names the database. The help of `report`, `trees`, `info` and `dwim` says what
|
||||
each prints. `sfdupes scan --help` and `sfdupes dwim --help` also list the
|
||||
default excludes of the system they run on, and the filesystem types the walk
|
||||
never records anything on.
|
||||
- `--help`, `-h`, alone or after a subcommand, prints the help text to stdout
|
||||
and exits 0. It writes nothing to stderr. `sfdupes help` and
|
||||
`sfdupes help COMMAND` do the same. The help of `sfdupes` and of `scan` names
|
||||
the database. The help of `report`, `trees`, `info` and `dwim` says what each
|
||||
prints. `sfdupes scan --help` and `sfdupes dwim --help` also list the default
|
||||
excludes of the system they run on, and the filesystem types the walk never
|
||||
records anything on.
|
||||
|
||||
### Duplicate detection
|
||||
|
||||
|
||||
Reference in new issue
Block a user