Print usage errors to stderr instead of stdout?

cakoosecakoose
in CLI

Using 'op' v0.5.5.

If you misspell a subcommand (e.g. "op udpate"), the tool will print the full usage message to stdout. I have two suggestions.

Instead of printing to stdout, print to stderr. This makes 'op' slightly easier to invoke from another program. For example, many 'op' subcommands provide their result on stdout; it's slightly easier to deal with subprocess if the "good" output appears on stdout and error output on stderr.

Another suggestion: instead of printing the full usage message, print something like "Unknown subcommand 'udpate'. Run with '--help' for more usage information." Printing the full usage information right off the bat is usually more noisy than helpful.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • graham_1Pgraham_1P

    Team Member
    edited May 6

    Good morning cakoose!

    Thank you for the feedback. I agree our error output can be a little verbose, and sometimes a bit inconsistent, depending on how you are consuming the cli. As we work towards 1.0.0 for the cli, we are going to be taking another look at our inputs, outputs, and errors. While I can't give any specifics, I can say that we are working towards standardising everything and ensuring a consistent interface across interactions with the cil. Stay tuned!

    If you would care to share, I would love to hear more about your use case, and how you consume the cli.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file