File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ pub fn build_app(interactive_output: bool) -> Command {
7979 Arg :: new ( "plain" )
8080 . overrides_with ( "plain" )
8181 . overrides_with ( "number" )
82+ . overrides_with ( "paging" )
8283 . short ( 'p' )
8384 . long ( "plain" )
8485 . action ( ArgAction :: Count )
@@ -303,6 +304,7 @@ pub fn build_app(interactive_output: bool) -> Command {
303304 . long ( "paging" )
304305 . overrides_with ( "paging" )
305306 . overrides_with ( "no-paging" )
307+ . overrides_with ( "plain" )
306308 . value_name ( "when" )
307309 . value_parser ( [ "auto" , "never" , "always" ] )
308310 . default_value ( "auto" )
Original file line number Diff line number Diff line change @@ -873,6 +873,42 @@ fn disable_pager_if_disable_paging_flag_comes_after_paging() {
873873 . stdout ( predicate:: eq ( "hello world\n " ) . normalize ( ) ) ;
874874}
875875
876+ #[ test]
877+ fn disable_pager_if_pp_flag_comes_after_paging ( ) {
878+ bat ( )
879+ . env ( "PAGER" , "echo pager-output" )
880+ . arg ( "--paging=always" )
881+ . arg ( "-pp" )
882+ . arg ( "test.txt" )
883+ . assert ( )
884+ . success ( )
885+ . stdout ( predicate:: eq ( "hello world\n " ) . normalize ( ) ) ;
886+ }
887+
888+ #[ test]
889+ fn enable_pager_if_disable_paging_flag_comes_before_paging ( ) {
890+ bat ( )
891+ . env ( "PAGER" , "echo pager-output" )
892+ . arg ( "-P" )
893+ . arg ( "--paging=always" )
894+ . arg ( "test.txt" )
895+ . assert ( )
896+ . success ( )
897+ . stdout ( predicate:: eq ( "pager-output\n " ) . normalize ( ) ) ;
898+ }
899+
900+ #[ test]
901+ fn enable_pager_if_pp_flag_comes_before_paging ( ) {
902+ bat ( )
903+ . env ( "PAGER" , "echo pager-output" )
904+ . arg ( "-pp" )
905+ . arg ( "--paging=always" )
906+ . arg ( "test.txt" )
907+ . assert ( )
908+ . success ( )
909+ . stdout ( predicate:: eq ( "pager-output\n " ) . normalize ( ) ) ;
910+ }
911+
876912#[ test]
877913fn pager_failed_to_parse ( ) {
878914 bat ( )
You can’t perform that action at this time.
0 commit comments