mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 09:01:56 +00:00 
			
		
		
		
	Cleaned up terminal-width validation even more
This commit is contained in:
		@@ -334,13 +334,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
 | 
			
		||||
                .validator(
 | 
			
		||||
                    |t| {
 | 
			
		||||
                        let is_offset = t.starts_with('+') || t.starts_with('-');
 | 
			
		||||
                        let num = if is_offset {
 | 
			
		||||
                            t.chars().skip(1).collect()
 | 
			
		||||
                        } else {
 | 
			
		||||
                            t
 | 
			
		||||
                        };
 | 
			
		||||
 | 
			
		||||
                        num.parse::<u32>()
 | 
			
		||||
                        t.parse::<i32>()
 | 
			
		||||
                            .map_err(|_e| "must be an offset or number")
 | 
			
		||||
                            .and_then(|v| if v == 0 && !is_offset {
 | 
			
		||||
                                Err("terminal width cannot be zero".into())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user