1
0
mirror of https://github.com/sharkdp/bat.git synced 2024-10-06 10:51:05 +01:00
bat/examples/inputs.rs

20 lines
581 B
Rust
Raw Normal View History

2020-05-16 23:16:51 +01:00
/// 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();
}