on d0da5af help sign in
bat/examples/inputs.rs
19 lines 626 B history raw
1/// A small demonstration of the Input API.
2/// This prints embedded bytes with a custom header and then reads from STDIN.
3use bat::{Input, PrettyPrinter};
5fn main() {
6 PrettyPrinter::new()
7 .header(true)
8 .grid(true)
9 .line_numbers(true)
10 .inputs(vec![
11 Input::from_bytes(b"echo 'Hello World!'")
12 .name("embedded.sh") // Dummy name provided to detect the syntax.
13 .kind("Embedded")
14 .title("An embedded shell script."),
15 Input::from_stdin().title("Standard Input").kind("FD"),
16 ])
17 .print()
18 .unwrap();