summaryrefslogtreecommitdiffstats
path: root/examples/inputs.rs
blob: be4e9e3b52a2b3efb4dcb5dc376fd7a154eb67eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/// A small demonstration of the Input API.
/// This prints embedded bytes with a custom header and then reads from STDIN.
use bat::{Input, PrettyPrinter};

fn main() {
    PrettyPrinter::new()
        .header(true)
        .grid(true)
        .line_numbers(true)
        .inputs(vec![
            Input::from_bytes(b"echo 'Hello World!'")
                .name("embedded.sh")
                .title("An embedded shell script.")
                .kind("Embedded"),
            Input::from_stdin().title("Standard Input").kind("FD"),
        ])
        .print()
        .unwrap();
}