particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

Print help messages and usage info to stdout, rather than stderr #606

Closed nrobinson2000 closed 3 years ago

nrobinson2000 commented 3 years ago

Description

I find it odd that help messages and usage information should be printed to stderr, when most commands print to stdout. This pull request would effectively change calls to yargs.showHelp() to yargs.showHelp('log') making help messages and usage information get printed to stdout, rather than stderr.

How to Test

Here is some Python code to verify that the help messages are printed to stdout instead of stderr:

from subprocess import run, PIPE

# Run `particle`
out = run(['npm', 'start'], stdout=PIPE, stderr=PIPE)
print(out.stdout.decode('utf-8'))

# Run `particle help`
out = run(['npm', 'start', 'help'], stdout=PIPE, stderr=PIPE)
print(out.stdout.decode('utf-8'))

# Run `particle help cloud`
out = run(['npm', 'start', 'help', 'cloud'], stdout=PIPE, stderr=PIPE)
print(out.stdout.decode('utf-8'))

Related Issues / Discussions

https://community.particle.io/t/particle-cli-help-messages-printed-to-stderr/59499

Completeness

busticated commented 3 years ago

thanks but this represents a pretty significant breaking-change and strays from user expectations (at least in context of common yargs usage)

closing but will keep it in mind for the future 👍