Skip to content

Output of scriggo help should be printed to stdout, not stderr #1011

@zapateo

Description

@zapateo

Currently, the output of scriggo help <topic> is printed to stderr instead of stdout:

$ scriggo help serve > >(sed 's/^/stdout: /') 2> >(sed 's/^/stderr: /')
stderr: usage: scriggo serve [-S n] [--metrics] [--disable-livereload] [-const name=value] [-http [host][:port]]
stderr: 
stderr: Serve runs a web server and serves the template rooted at the current
stderr: directory. It is useful to learn Scriggo templates.
stderr: 
stderr: It renders HTML and Markdown files based on file extension.
stderr: 
stderr: For example:
stderr: 
stderr:     http://localhost:8080/article
stderr: 
[...]

And this is inconvenient when using a pager or any other application, because it forces you to redirect stderr to stdout.

scriggo help build | codium -      # doesnt work
scriggo help build 2>&1 | codium - # works

Printing help to stdout seems to be the behavior of various Unix tools I've tried, and it's also what the go command does:

ls --help > >(sed 's/^/stdout: /') 2> >(sed 's/^/stderr: /')
stdout: Uso: ls [OPZIONE]... [FILE]...
stdout: List information about the FILEs (the current directory by default).
stdout: Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
stdout: 
stdout: Mandatory arguments to long options are mandatory for short options too.
stdout:   -a, --all                  non nasconde le voci che iniziano con .
stdout:   -A, --almost-all           non elenca le voci . e ..
stdout:       --author               con -l stampa l'autore di ogni file
stdout:   -b, --escape               stampa escape in stile C per i caratteri non grafici
stdout:       --block-size=SIZE      with -l, scale sizes by SIZE when printing them;
[...]
go help build > >(sed 's/^/stdout: /') 2> >(sed 's/^/stderr: /')
stdout: usage: go build [-o output] [build flags] [packages]
stdout: 
stdout: Build compiles the packages named by the import paths,
stdout: along with their dependencies, but it does not install the results.
stdout: 
stdout: If the arguments to build are a list of .go files from a single directory,
stdout: build treats them as a list of source files specifying a single package.
stdout: 
[...]

We should investigate this issue in Scriggo, but be careful to maintain the fact that in case of an incorrect command, the output should go to stderr, not stdout.

We previously opened a PR, which was then closed because the resolution was more complex than expected: #1008.

Metadata

Metadata

Assignees

No one assigned

    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