Feature: Print response codes/strings to stderr
flajr opened this issue · comments
Firstly thank you kindly for this project and consideration of this feature request!
What I would like to propose is printing all response codes and strings to stderr
for skysh
utility (and/or other utils)
That would in my opinion simplify parsing and working with CLI utility in scripts or in command line.
Rationale is this example:
This would parse also response (Okay)
but if this fail I will never know until I see full stdout
.
Example: skysh -e "lskeys" |grep Ok
If we want to handle more use cases, we talked about --output=stderr
that could change behaviour of printing based on this option.
Also simple -q --quite
flag could mitigate all reponses if we only want data output to stdout
.
Let's look into the specifics. So, we're going to print resp strings/codes to stderr
instead of printing it to stdout
. This is a breaking change, but is fine since we're moving closer to 0.8 which will introduce multiple breaking changes. Customization of behavior should also be allowed to enable users to adjust output to their specific workflow.
+1. Nominated
I would like to work on this. So far, I have identified the location where the error is being logged. By changing it to eprintln
, we can print that into stderr.
Line 47 in b83e42a
I want to discuss the configuration options that you would like to provide to the users. As mentioned in the first comment, we can have a --output
flag, which can take values stderr
and stdout
, or we can just add the -q --quite
flag. If we don't want this to be a breaking change, then we can make stderr
opt-in instead. I would like to hear your thoughts.