You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/but/agents.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,12 @@
1
1
### Output
2
-
* Usable output goes to `stdout` with `wrinteln!(stdout, "…")`, with `stdout` being a re-used variable filled with `std::io::stdout()`.
3
-
- Use `atty::is` to print human output, otherwise print output optimised for use in shell scripts, when single values are returned.
4
-
* Error or side-channel information goes to `stderr` with `writeln!(stderr, "…")`, with `stderr` being a re-used variable filled with `std::io::stderr()` as needed.
2
+
* Usable output goes to `stdout` with `writeln!(stdout, …).ok()`.
3
+
- Obtain `stdout` once per function using `let mut stdout = std::io::stdout();`
4
+
- Use `stdout` when writing: `writeln!(stdout, "…").ok();`
5
+
- Use `atty::is` to print human output, otherwise print output optimised for use in bash scripts, when single values are returned.
6
+
* Error or side-channel information goes to `stderr` with `writeln!(stderr, …).ok()`.
7
+
- Obtain `stderr` once per function using `let mut stderr = std::io::stderr();`
8
+
- Use `stderr` when writing: `writeln!(stderr, "…").ok();`
9
+
* The `.ok()` at the end ignores write errors gracefully (e.g., broken pipe) instead of panicking.
5
10
*`--json` only outputs the happy path, there are no JSON errors.
0 commit comments