mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 00:51:56 +00:00 
			
		
		
		
	Do not show file header for directories
This also adds a better error message. closes #292
This commit is contained in:
		@@ -53,7 +53,15 @@ impl<'b> Controller<'b> {
 | 
			
		||||
        {
 | 
			
		||||
            let reader: Box<BufRead> = match filename {
 | 
			
		||||
                InputFile::StdIn => Box::new(stdin.lock()),
 | 
			
		||||
                InputFile::Ordinary(filename) => Box::new(BufReader::new(File::open(filename)?)),
 | 
			
		||||
                InputFile::Ordinary(filename) => {
 | 
			
		||||
                    let file = File::open(filename)?;
 | 
			
		||||
 | 
			
		||||
                    if file.metadata()?.is_dir() {
 | 
			
		||||
                        return Err(format!("'{}' is a directory.", filename).into());
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Box::new(BufReader::new(file))
 | 
			
		||||
                }
 | 
			
		||||
                InputFile::ThemePreviewFile => Box::new(THEME_PREVIEW_FILE),
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user