1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-22 16:53:19 +00:00

successfully setting the terminal title to bat's input's names

This commit is contained in:
Oliver looney
2023-12-10 17:17:19 +00:00
parent 4863d428dd
commit b9b554248d
4 changed files with 14 additions and 10 deletions
+10
View File
@@ -227,9 +227,19 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<
Ok(())
}
fn set_terminal_title_to_inputs_names(inputs: &Vec<Input>) {
let mut input_names = "bat: ".to_string();
for input in inputs.iter() {
input_names = input_names + &input.description.name.to_string() + ", "
}
print!("\x1b]2;{}\x07", input_names);
io::stdout().flush().unwrap();
}
fn run_controller(inputs: Vec<Input>, config: &Config, cache_dir: &Path) -> Result<bool> {
let assets = assets_from_cache_or_binary(config.use_custom_assets, cache_dir)?;
let controller = Controller::new(config, &assets);
set_terminal_title_to_inputs_names(&inputs);
controller.run(inputs, None)
}