mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-10-30 06:33:59 +00:00 
			
		
		
		
	Fix #1413 Can't use bat at all! (Error: Use of bat as a pager is disallowed...)
				
					
				
			Fixed by implementing the proposal by sharkdp: * Allow PAGER=bat, but ignore the setting in bat and simply default to less. Unless of course, BAT_PAGER or --pager is used to overwrite the value of PAGER. * Disallow the usage of bat within BAT_PAGER and --pager.
This commit is contained in:
		
				
					committed by
					
						 David Peter
						David Peter
					
				
			
			
				
	
			
			
			
						parent
						
							060b9981b5
						
					
				
				
					commit
					dd0d44bbb3
				
			| @@ -499,6 +499,28 @@ fn pager_disable() { | ||||
|         .stdout(predicate::eq("hello world\n").normalize()); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn env_var_pager_value_bat() { | ||||
|     bat() | ||||
|         .env("PAGER", "bat") | ||||
|         .arg("--paging=always") | ||||
|         .arg("test.txt") | ||||
|         .assert() | ||||
|         .success() | ||||
|         .stdout(predicate::eq("hello world\n").normalize()); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn env_var_bat_pager_value_bat() { | ||||
|     bat() | ||||
|         .env("BAT_PAGER", "bat") | ||||
|         .arg("--paging=always") | ||||
|         .arg("test.txt") | ||||
|         .assert() | ||||
|         .failure() | ||||
|         .stderr(predicate::str::contains("bat as a pager is disallowed")); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn pager_value_bat() { | ||||
|     bat() | ||||
| @@ -506,7 +528,8 @@ fn pager_value_bat() { | ||||
|         .arg("--paging=always") | ||||
|         .arg("test.txt") | ||||
|         .assert() | ||||
|         .failure(); | ||||
|         .failure() | ||||
|         .stderr(predicate::str::contains("bat as a pager is disallowed")); | ||||
| } | ||||
|  | ||||
| /// We shall use less instead of most if PAGER is used since PAGER | ||||
|   | ||||
		Reference in New Issue
	
	Block a user