Skip to content

Commit

Permalink
Merge branch 'master' into mhelsley-fix-lessopen
Browse files Browse the repository at this point in the history
  • Loading branch information
mhelsley authored Oct 7, 2024
2 parents 3e5f426 + eca6b8a commit 431344b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/bat/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<

let default_theme = HighlightingAssets::default_theme();
for theme in assets.themes() {
let default_theme_info = if default_theme == theme {
let default_theme_info = if !config.loop_through && default_theme == theme {
" (default)"
} else {
""
Expand Down
10 changes: 10 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,23 @@ fn list_themes_without_colors() {

bat()
.arg("--color=never")
.arg("--decorations=always") // trick bat into setting `Config::loop_through` to false
.arg("--list-themes")
.assert()
.success()
.stdout(predicate::str::contains("DarkNeon").normalize())
.stdout(predicate::str::contains(default_theme_chunk).normalize());
}

#[test]
fn list_themes_to_piped_output() {
bat()
.arg("--list-themes")
.assert()
.success()
.stdout(predicate::str::contains("(default)").not());
}

#[test]
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
fn short_help() {
Expand Down

0 comments on commit 431344b

Please sign in to comment.