infostellarinc / stellarcli

A command line utility for accessing the StellarStation API
Apache License 2.0
5 stars 9 forks source link

Inconsistent exit codes #120

Open chelliwell opened 4 years ago

chelliwell commented 4 years ago

For scripting the use of stellarcli, the exit codes can be pretty important. I've noticed some variability though when commands are wrongly constructed: stellarcli.exe satellite open-strea 5 => 0 stellarcli.exe satellit open-stream 5 => 1 stellarcli.exe blah open-stream 5 => 1 stellarcli.exe blah => 1 stellarcli.exe satellite blah => 0 stellarcli.exe satellite open-stream -blah => 1

I think it maybe depends on whether or not it drops through to a 'help' message. Perhaps need to differentiate between "help because the command wasn't understood" vs. "help because of the --help"? Simple answer, of course, don't construct bad commands...! ;) But when/if the command line options evolve over time, it would be good if a script can spot a flagrant mistake.

davidk81 commented 4 years ago

Thanks for your feedback. This seems to be caused by cobra library used to parse commands. I found open issues https://github.com/spf13/cobra/issues/749 and https://github.com/spf13/cobra/issues/582

I've also tested a stellarcli build with cobra 1.0.0 release, but the problem still seem to exist.