CLI prints to stderr
Closed this issue · 4 comments
For some reason the CLI now prints to stderr instead of to stdout, making piping more difficult.
# Empty output
upctl server list 2>/dev/null
# Prints everything
upctl server list 1>/dev/null
Version: 2.1.0
Build date: 2022-09-07T10:46:33Z
Built with: go1.18.5
I now see this is listed in the release notes
Breaking: Human output, including errors, is written to stderr instead of stdout.
... why?
Hi, sorry for the confusion!
The idea was that human output is not ideal for passing to a another command for processing, but of course there are some other use cases as well, such as piping the output to grep
. We are currently refactoring the output logic and could further tune how the output streams are used for human output.
What is your use-case for piping? I'm thinking if there is something we could add on the upctl
side to remove the need for piping.
I pipe to e.g. check if servers are up and running, as a step in a bigger script.
Fixed it now with -ojson | jq
.
I would say that human and machine output can both go to stdin since you only have one at a time. If you specify machine output you won't have human output anyways.
This will soon be fixed in v2.2.0