diff options
35 files changed, 448 insertions, 118 deletions
diff --git a/.github/workflows/require-changelog-for-PRs.yml b/.github/workflows/require-changelog-for-PRs.yml index 263fee22..9b9d7cde 100644 --- a/.github/workflows/require-changelog-for-PRs.yml +++ b/.github/workflows/require-changelog-for-PRs.yml @@ -29,5 +29,5 @@ jobs: ADDED=$(git diff -U0 "origin/${PR_BASE}" HEAD -- CHANGELOG.md | grep -P '^\+[^\+].+$') echo "Added lines in CHANGELOG.md:" echo "$ADDED" - echo "Grepping for PR info:" + echo "Grepping for PR info (see CONTRIBUTING.md):" grep "#${PR_NUMBER}\\b.*@${PR_SUBMITTER}\\b" <<< "$ADDED" diff --git a/CHANGELOG.md b/CHANGELOG.md index fde56d37..c7ebdc55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Features +- Set terminal title to file names when Paging is not Paging::Never #2807 (@Oliver-Looney) +- `bat --squeeze-blank`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) +- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze-blank`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) +- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815) + ## Bugfixes - Fix long file name wrapping in header, see #2835 (@FilipRazek) @@ -24,6 +29,8 @@ - Pull in fix for unsafe-libyaml security advisory, see #2812 (@dtolnay) - Update git-version dependency to use Syn v2, see #2816 (@dtolnay) - Update git2 dependency to v0.18.2, see #2852 (@eth-p) +- Improve performance when color output disabled, see #2397 and #2857 (@eth-p) +- Relax syntax mapping rule restrictions to allow brace expansion #2865 (@cyqsimon) - Apply clippy fixes #2864 (@cyqsimon) - Faster startup by offloading glob matcher building to a worker thread #2868 (@cyqsimon) @@ -31,6 +38,12 @@ - `cmd-help`: scope subcommands followed by other terms, and other misc improvements, see #2819 (@victor-gp) - Upgrade JQ syntax, see #2820 (@dependabot[bot]) +- Add syntax mapping for quadman quadlets #2866 (@cyqsimon) +- Map containers .conf files to TOML syntax #2867 (@cyqsimon) +- Associate `xsh` files with `xonsh` syntax that is Python, see #2840 (@anki-code). +- Added auto detect syntax for `.jsonc` #2795 (@mxaddict) +- Added auto detect syntax for `.aws/{config,credentials}` #2795 (@mxaddict) +- Add syntax mapping for Wireguard config #2874 (@cyqsimon) ## Themes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe38e2f3..2b381b38 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,21 +6,42 @@ Thank you for considering to contribute to `bat`! ## Add an entry to the changelog -If your contribution changes the behavior of `bat` (as opposed to a typo-fix -in the documentation), please update the [`CHANGELOG.md`](CHANGELOG.md) file -and describe your changes. This makes the release process much easier and -therefore helps to get your changes into a new `bat` release faster. +Keeping the [`CHANGELOG.md`](CHANGELOG.md) file up-to-date makes the release +process much easier and therefore helps to get your changes into a new `bat` +release faster. However, not every change to the repository requires a +changelog entry. Below are a few examples of that. + +Please update the changelog if your contribution contains changes regarding +any of the following: + - the behavior of `bat` + - syntax mappings + - syntax definitions + - themes + - the build system, linting, or CI workflows + +A changelog entry is not necessary when: + - updating documentation + - fixing typos + +>[!NOTE] +> For PRs, a CI workflow verifies that a suitable changelog entry is +> added. If such an entry is missing, the workflow will fail. If your +> changes do not need an entry to the changelog (see above), that +> workflow failure can be disregarded. + + +### Changelog entry format The top of the `CHANGELOG` contains a *"unreleased"* section with a few subsections (Features, Bugfixes, …). Please add your entry to the subsection that best describes your change. -Entries follow this format: +Entries must follow this format: ``` - Short description of what has been changed, see #123 (@user) ``` -Here, `#123` is the number of the original issue and/or your pull request. -Please replace `@user` by your GitHub username. +Please replace `#123` with the number of your pull request (not issue) and +`@user` by your GitHub username. ## Development @@ -129,8 +129,8 @@ dependencies = [ "globset", "grep-cli", "home", - "indexmap 2.2.2", - "itertools", + "indexmap", + "itertools 0.12.1", "nix", "nu-ansi-term", "once_cell", @@ -370,6 +370,15 @@ dependencies = [ ] [[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] name = "difflib" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -555,9 +564,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" dependencies = [ "bitflags 2.4.0", "libc", @@ -638,16 +647,6 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" @@ -667,6 +666,15 @@ dependencies = [ ] [[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] name = "itoa" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -788,14 +796,20 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "nu-ansi-term" -version = "0.49.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68" +checksum = "dd2800e1520bdc966782168a627aa5d1ad92e33b984bf7c7615d31280c83ff14" dependencies = [ "windows-sys 0.48.0", ] [[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] name = "num-traits" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -805,15 +819,6 @@ dependencies = [ ] [[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -896,12 +901,12 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "plist" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a4a0cfc5fb21a09dc6af4bf834cf10d4a32fccd9e2ea468c4b1751a097487aa" +checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" dependencies = [ "base64", - "indexmap 1.9.1", + "indexmap", "line-wrap", "quick-xml", "serde", @@ -909,6 +914,12 @@ dependencies = [ ] [[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -923,7 +934,7 @@ dependencies = [ "anstyle", "difflib", "float-cmp", - "itertools", + "itertools 0.11.0", "normalize-line-endings", "predicates-core", "regex", @@ -956,9 +967,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" dependencies = [ "memchr", ] @@ -1182,7 +1193,7 @@ version = "0.9.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a15e0ef66bf939a7c890a0bf6d5a733c70202225f9888a89ed5c62298b019129" dependencies = [ - "indexmap 2.2.2", + "indexmap", "itoa", "ryu", "serde", @@ -1346,13 +1357,33 @@ dependencies = [ [[package]] name = "time" -version = "0.3.14" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ + "deranged", "itoa", - "libc", - "num_threads", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +dependencies = [ + "num-conv", + "time-core", ] [[package]] @@ -1376,7 +1407,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325" dependencies = [ - "indexmap 2.2.2", + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -1398,7 +1429,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.2", + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -41,7 +41,7 @@ regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine [dependencies] -nu-ansi-term = "0.49.0" +nu-ansi-term = "0.50.0" ansi_colours = "^1.2" bincode = "1.0" console = "0.15.7" @@ -86,7 +86,7 @@ features = ["wrap_help", "cargo"] [target.'cfg(target_os = "macos")'.dependencies] home = "0.5.9" -plist = "1.5.1" +plist = "1.6.0" [dev-dependencies] assert_cmd = "2.0.12" @@ -103,7 +103,7 @@ nix = { version = "0.26.4", default-features = false, features = ["term"] } [build-dependencies] anyhow = "1.0.78" indexmap = { version = "2.2.2", features = ["serde"] } -itertools = "0.11.0" +itertools = "0.12.1" once_cell = "1.18" regex = "1.10.2" serde = "1.0" diff --git a/build/syntax_mapping.rs b/build/syntax_mapping.rs index 959caea8..91a448f6 100644 --- a/build/syntax_mapping.rs +++ b/build/syntax_mapping.rs @@ -53,14 +53,16 @@ struct Matcher(Vec<MatcherSegment>); /// /// Note that this implementation is rather strict: it will greedily interpret /// every valid environment variable replacement as such, then immediately -/// hard-error if it finds a '$', '{', or '}' anywhere in the remaining text -/// segments. +/// hard-error if it finds a '$' anywhere in the remaining text segments. /// /// The reason for this strictness is I currently cannot think of a valid reason -/// why you would ever need '$', '{', or '}' as plaintext in a glob pattern. -/// Therefore any such occurrences are likely human errors. +/// why you would ever need '$' as plaintext in a glob pattern. Therefore any +/// such occurrences are likely human errors. /// /// If we later discover some edge cases, it's okay to make it more permissive. +/// +/// Revision history: +/// - 2024-02-20: allow `{` and `}` (glob brace expansion) impl FromStr for Matcher { type Err = anyhow::Error; fn from_str(s: &str) -> Result<Self, Self::Err> { @@ -106,7 +108,7 @@ impl FromStr for Matcher { if non_empty_segments .iter() .filter_map(Seg::text) - .any(|t| t.contains(['$', '{', '}'])) + .any(|t| t.contains('$')) { bail!(r#"Invalid matcher: "{s}""#); } diff --git a/doc/long-help.txt b/doc/long-help.txt index 247120fb..a6ffe962 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -116,6 +116,12 @@ Options: --list-themes Display a list of supported themes for syntax highlighting. + -s, --squeeze-blank + Squeeze consecutive empty lines into a single empty line. + + --squeeze-limit <squeeze-limit> + Set the maximum number of consecutive empty lines to be printed. + --style <components> Configure which elements (line numbers, file headers, grid borders, Git modifications, ..) to display in addition to the file contents. The argument is a comma-separated list of @@ -123,6 +129,9 @@ Options: set a default style, add the '--style=".."' option to the configuration file or export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). + By default, the following components are enabled: + changes, grid, header-filename, numbers, snip + Possible values: * default: enables recommended style components (default). @@ -160,6 +169,9 @@ Options: --acknowledgements Show acknowledgements. + --set-terminal-title + Sets terminal title to filenames when using a pager. + -h, --help Print help (see a summary with '-h') diff --git a/doc/short-help.txt b/doc/short-help.txt index 118dbce2..305bbf3d 100644 --- a/doc/short-help.txt +++ b/doc/short-help.txt @@ -43,6 +43,8 @@ Options: Set the color theme for syntax highlighting. --list-themes Display all supported highlighting themes. + -s, --squeeze-blank + Squeeze consecutive empty lines. --style <components> Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip). diff --git a/examples/list_syntaxes_and_themes.rs b/examples/list_syntaxes_and_themes.rs index 43ec1414..0381f000 100644 --- a/examples/list_syntaxes_and_themes.rs +++ b/examples/list_syntaxes_and_themes.rs @@ -13,6 +13,6 @@ fn main() { println!("Themes:"); for theme in printer.themes() { - println!("- {}", theme); + println!("- {theme}"); } } diff --git a/src/assets.rs b/src/assets.rs index 0129f76b..9655553d 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -380,7 +380,7 @@ fn asset_from_contents<T: serde::de::DeserializeOwned>( } else { bincode::deserialize_from(contents) } - .map_err(|_| format!("Could not parse {}", description).into()) + .map_err(|_| format!("Could not parse {description}").into()) } fn asset_from_cache<T: serde::de::DeserializeOwned>( @@ -396,7 +396,7 @@ fn asset_from_cache<T: serde::de::DeserializeOwned>( ) })?; asset_from_contents(&contents[..], description, compressed) - .map_err(|_| format!("Could not parse cached {}", description).into()) + .map_err(|_| format!("Could not parse cached {description}").into()) } #[cfg(target_os = "macos")] @@ -466,7 +466,7 @@ mod tests { let file_path = self.temp_dir.path().join(file_name); { let mut temp_file = File::create(&file_path).unwrap(); - writeln!(temp_file, "{}", first_line).unwrap(); + writeln!(temp_file, "{first_line}").unwrap(); } let input = Input::ordinary_file(&file_path); @@ -514,8 +514,7 @@ mod tests { if !consistent { eprintln!( - "Inconsistent syntax detection:\nFor File: {}\nFor Reader: {}", - as_file, as_reader + "Inconsistent syntax detection:\nFor File: {as_file}\nFor Reader: {as_reader}" ) } diff --git a/src/assets/build_assets.rs b/src/assets/build_assets.rs index f3448679..5406c2f7 100644 --- a/src/assets/build_assets.rs +++ b/src/assets/build_assets.rs @@ -93,7 +93,7 @@ fn print_unlinked_contexts(syntax_set: &SyntaxSet) { if !missing_contexts.is_empty() { println!("Some referenced contexts could not be found!"); for context in missing_contexts { - println!("- {}", context); + println!("- {context}"); } } } @@ -152,7 +152,7 @@ pub(crate) fn asset_to_contents<T: serde::Serialize>( } else { bincode::serialize_into(&mut contents, asset) } - .map_err(|_| format!("Could not serialize {}", description))?; + .map_err(|_| format!("Could not serialize {description}"))?; Ok(contents) } diff --git a/src/assets/build_assets/acknowledgements.rs b/src/assets/build_assets/acknowledgements.rs index fc915548..c4fde919 100644 --- a/src/assets/build_assets/acknowledgements.rs +++ b/src/assets/build_assets/acknowledgements.rs @@ -80,7 +80,7 @@ fn handle_license(path: &Path) -> Result<Option<String>> { } else if license_not_needed_in_acknowledgements(&license_text) { Ok(None) } else { - Err(format!("ERROR: License is of unknown type: {:?}", path).into()) + Err(format!("ERROR: License is of unknown type: {path:?}").into()) } } @@ -125,7 +125,7 @@ fn append_to_acknowledgements( relative_path: &str, license_text: &str, ) { - write!(acknowledgements, "## {}\n\n{}", relative_path, license_text).ok(); + write!(acknowledgements, "## {relative_path}\n\n{license_text}").ok(); // Make sure the last char is a newline to not mess up formatting later if acknowledgements diff --git a/src/assets/lazy_theme_set.rs b/src/assets/lazy_theme_set.rs index fcc3eb46..f3f3f690 100644 --- a/src/assets/lazy_theme_set.rs +++ b/src/assets/lazy_theme_set.rs @@ -88,7 +88,7 @@ impl TryFrom<ThemeSet> for LazyThemeSet { let lazy_theme = LazyTheme { serialized: crate::assets::build_assets::asset_to_contents( &theme, - &format!("theme {}", name), + &format!("theme {name}"), COMPRESS_LAZY_THEMES, )?, deserialized: OnceCell::new(), diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index f8007897..6fc85321 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -293,6 +293,17 @@ impl App { use_custom_assets: !self.matches.get_flag("no-custom-assets"), #[cfg(feature = "lessopen")] use_lessopen: self.matches.get_flag("lessopen"), + set_terminal_title: self.matches.get_flag("set-terminal-title"), + squeeze_lines: if self.matches.get_flag("squeeze-blank") { + Some( + self.matches + .get_one::<usize>("squeeze-limit") + .map(|limit| limit.to_owned()) + .unwrap_or(1), + ) + } else { + None + }, }) } diff --git a/src/bin/bat/assets.rs b/src/bin/bat/assets.rs index a54927b8..0eeb5bf1 100644 --- a/src/bin/bat/assets.rs +++ b/src/bin/bat/assets.rs @@ -44,7 +44,7 @@ pub fn assets_from_cache_or_binary( } fn clear_asset(path: PathBuf, description: &str) { - print!("Clearing {} ... ", description); + print!("Clearing {description} ... "); match fs::remove_file(&path) { Err(err) if err.kind() == io::ErrorKind::NotFound => { println!("skipped (not present)"); diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index e8222a1d..b82762b6 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -388,6 +388,21 @@ pub fn build_app(interactive_output: bool) -> Command { .long_help("Display a list of supported themes for syntax highlighting."), ) .arg( + Arg::new("squeeze-blank") + .long("squeeze-blank") + .short('s') + .action(ArgAction::SetTrue) + .help("Squeeze consecutive empty lines.") + .long_help("Squeeze consecutive empty lines into a single empty line.") + ) + .arg( + Arg::new("squeeze-limit") + .long("squeeze-limit") + .value_parser(|s: &str| s.parse::<usize>().map_err(|_| "Requires a non-negative number".to_owned())) + .long_help("Set the maximum number of consecutive empty lines to be printed.") + .hide_short_help(true) + ) + .arg( Arg::new("style") .long("style") .value_name("components") @@ -415,7 +430,7 @@ pub fn build_app(interactive_output: bool) -> Command { }); if let Some(invalid) = invalid_vals.next() { - Err(format!("Unknown style, '{}'", invalid)) + Err(format!("Unknown style, '{invalid}'")) } else { Ok(val.to_owned()) } @@ -432,6 +447,8 @@ pub fn build_app(interactive_output: bool) -> Command { pre-defined style ('full'). To set a default style, add the \ '--style=\"..\"' option to the configuration file or export the \ BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\ + By default, the following components are enabled:\n \ + changes, grid, header-filename, numbers, snip\n\n\ Possible values:\n\n \ * default: enables recommended style components (default).\n \ * full: enables all available components.\n \ @@ -567,6 +584,13 @@ pub fn build_app(interactive_output: bool) -> Command { .action(ArgAction::SetTrue) .hide_short_help(true) .help("Show acknowledgements."), + ) + .arg( + Arg::new("set-terminal-title") + .long("set-terminal-title") + .action(ArgAction::SetTrue) + .hide_short_help(true) + .help("Sets terminal title to filenames when using a pager."), ); // Check if the current directory contains a file name cache. Otherwise, diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index f48abdc1..38595721 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -222,16 +222,37 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result< )?; } else { for theme in assets.themes() { - writeln!(stdout, "{}", theme)?; + writeln!(stdout, "{theme}")?; } } Ok(()) } +fn set_terminal_title_to(new_terminal_title: String) { + let osc_command_for_setting_terminal_title = "\x1b]0;"; + let osc_end_command = "\x07"; + print!("{osc_command_for_setting_terminal_title}{new_terminal_title}{osc_end_command}"); + io::stdout().flush().unwrap(); +} + +fn get_new_terminal_title(inputs: &Vec<Input>) -> String { + let mut new_terminal_title = "bat: ".to_string(); + for (index, input) in inputs.iter().enumerate() { + new_terminal_title += input.description().title(); + if index < inputs.len() - 1 { + new_terminal_title += ", "; + } + } + new_terminal_title +} + fn run_controller(inputs: Vec<Input>, config: &Config, cache_dir: &Path) -> Result<bool> { |