mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 00:51:56 +00:00 
			
		
		
		
	Merge pull request #3075 from einfachIrgendwer0815/fix/3073_list_themes
Don't output default theme info to piped stdout
This commit is contained in:
		@@ -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 {
 | 
			
		||||
            ""
 | 
			
		||||
 
 | 
			
		||||
@@ -300,6 +300,7 @@ 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()
 | 
			
		||||
@@ -307,6 +308,15 @@ fn list_themes_without_colors() {
 | 
			
		||||
        .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() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user