2019-10-20 21:53:34 +02:00
|
|
|
use bat::{
|
|
|
|
assets::HighlightingAssets,
|
2020-03-21 21:03:57 +01:00
|
|
|
config::{Config, InputFile, StyleComponent, StyleComponents},
|
2019-10-20 21:53:34 +02:00
|
|
|
controller::Controller,
|
|
|
|
};
|
|
|
|
use console::Term;
|
|
|
|
use std::process;
|
|
|
|
|
|
|
|
fn main() {
|
2020-02-12 23:23:49 +01:00
|
|
|
let files = std::env::args_os().skip(1).collect::<Vec<_>>();
|
2019-10-20 21:53:34 +02:00
|
|
|
|
|
|
|
if files.is_empty() {
|
|
|
|
eprintln!("No input files specified");
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
let config = Config {
|
|
|
|
term_width: Term::stdout().size().1 as usize,
|
|
|
|
colored_output: true,
|
|
|
|
true_color: true,
|
2020-03-21 20:54:16 +01:00
|
|
|
style_components: StyleComponents::new(&[
|
|
|
|
StyleComponent::Header,
|
|
|
|
StyleComponent::Grid,
|
|
|
|
StyleComponent::Numbers,
|
2019-10-20 21:53:34 +02:00
|
|
|
]),
|
|
|
|
files: files.iter().map(|file| InputFile::Ordinary(file)).collect(),
|
|
|
|
theme: "1337".into(),
|
|
|
|
..Default::default()
|
|
|
|
};
|
2020-03-21 16:48:27 +01:00
|
|
|
let assets = HighlightingAssets::from_binary();
|
2019-10-20 21:53:34 +02:00
|
|
|
|
|
|
|
Controller::new(&config, &assets).run().expect("no errors");
|
|
|
|
}
|