ipsavitsky opened a new issue, #2158: URL: https://github.com/apache/buildstream/issues/2158
As discussed in the [matrix channel](https://matrix.to/#/!NHkwyjdxGqpzRNYJZF:matrix.org/$178462649612760lRCWd:matrix.org?via=gnome.org&via=matrix.org&via=kde.org) Right now there is only one format of logging which is very nice and human-readable, but, unfortunately, machine unreadable. This issue is set up to make it possible to set up an output format using a `--format` flag. In the matrix channel several formats were proposed: ### `--format=pretty` This would be the default format and it would map to the current style of output that buildstream does ### `--format=minimal` This output format would output only the text, no formatting, no padding, no fancy unicode symbols. This format would be useful in making short pipes into bash utilities. Like ``` bst --format=minimal artifact list-contents my-component.bst | as-tree ``` ### `--format=json` This output format would be useful in more complex tooling, such as `nushell` or even scripts that wrap `bst`, so that building tooling around bst becomes possible, like so: ```rust #[derive(Deserialize)] struct Message { // potential message fields } fn main() { let mut child = Command::new("bst") .arg("--format=json") .arg("build") .stdout(Stdio::piped()) .stderr(Stdio::inherit()) .spawn() .expect("failed to spawn bst"); let stdout = child.stdout.take().unwrap(); for line in BufReader::new(stdout).lines().map_while(Result::ok) { // handling messages from bst } let status = child.wait().expect("bst process lost"); std::process::exit(status.code().unwrap_or(1)); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
