-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Follow conventions for Conan 2.0 CLI output #12235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to discuss some approaches
conan/cli/commands/__init__.py
Outdated
myjson = json.dumps(data, indent=4, cls=ConanJSONEncoder) | ||
return myjson | ||
ConanOutput(stream=sys.stdout).writeln(myjson) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this. We were discussing about how ConanOutput
was always for our messages to stderr, while we would use other things for stdout. Becaye also there is extra configurations, like loggers or the logger-as-json that can affect how the ConanOutput
behaves, and that would be bad for the stdout
output, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see, then probably what needs to be used is cli_out_write
(we can change the name later perhaps), I'll make the changes and we see from there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job
Still working on it ...
Following the convention for Conan 2.0 that the results for the commands are dumped to the stdout. Rest of operations while running the command are dumped to stderr.
Several fixes in the output for the CLI:
text
formatter if they have to output something to the stdout.text
formatter is not shown in the help and is used by default in case the command defined it.I think that the formatters were not correctly used in the code because they only formatted the output and not write anything and maybe that was a bit confusing, so now the formatters are changed to also do the actual output to stdout using
cli_out_write()