Add syntaxes and themes method

This commit is contained in:
sharkdp authored and David Peter committed 2020-04-22 23:55:28 +02:00
1 parent cba9df746e
commit 53a973e9dd
4 files changed
+30 -3

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
/// A program that prints its own source code using the bat library
use bat::{LineRange, PrettyPrinter, WrappingMode, PagingMode};
use bat::{LineRange, PagingMode, PrettyPrinter, WrappingMode};
fn main() {
PrettyPrinter::new()
+18
View File
@@ -0,0 +1,18 @@
/// A simple program that prints its own source code using the bat library
use bat::PrettyPrinter;
fn main() {
let printer = PrettyPrinter::new();
println!("Syntaxes:");
for syntax in printer.syntaxes() {
println!("- {} ({})", syntax.name, syntax.file_extensions.join(", "));
}
println!();
println!("Themes:");
for theme in printer.themes() {
println!("- {}", theme);
}
}