Add a global `--format` option for machine-readable output
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 42/100
Research direction
Start at the global bst command entry point and trace how the current human-readable logging is selected. The work is complete when --format supports the described pretty, minimal, and json behaviors globally while preserving the current output as the default.
Written by the indexing model from the issue text.
Description
As discussed in the matrix channel
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:
#[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));
}
- Dominant language
- Python
- Stars
- 144
- Forks
- 45
- Avg merge
- 20h 38m
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/buildstream
-
logging
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
apache/buildstream#2150 · 3 comments ·
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
apache/buildstream#2143 · 2 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
apache/buildstream#2194 ·
-
Modification time of an element with an open workspace propagates into consumer element's sandbox Openbug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
apache/buildstream#2186 · 2 comments · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
apache/buildstream#2184 · 1 comment ·
All issues in apache/buildstream
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·