File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,10 @@ impl App {
207207 || match self . matches . get_one :: < String > ( "color" ) . map ( |s| s. as_str ( ) ) {
208208 Some ( "always" ) => true ,
209209 Some ( "never" ) => false ,
210- Some ( "auto" ) => env:: var_os ( "NO_COLOR" ) . is_none ( ) && self . interactive_output ,
210+ Some ( "auto" ) => {
211+ !env:: var_os ( "NO_COLOR" ) . is_some_and ( |x| !x. is_empty ( ) )
212+ && self . interactive_output
213+ }
211214 _ => unreachable ! ( "other values for --color are not allowed" ) ,
212215 } ,
213216 paging_mode,
Original file line number Diff line number Diff line change @@ -19,11 +19,12 @@ static VERSION: Lazy<String> = Lazy::new(|| {
1919} ) ;
2020
2121pub fn build_app ( interactive_output : bool ) -> Command {
22- let color_when = if interactive_output && env:: var_os ( "NO_COLOR" ) . is_none ( ) {
23- ColorChoice :: Auto
24- } else {
25- ColorChoice :: Never
26- } ;
22+ let color_when =
23+ if interactive_output && !env:: var_os ( "NO_COLOR" ) . is_some_and ( |x| !x. is_empty ( ) ) {
24+ ColorChoice :: Auto
25+ } else {
26+ ColorChoice :: Never
27+ } ;
2728
2829 let mut app = Command :: new ( crate_name ! ( ) )
2930 . version ( VERSION . as_str ( ) )
You can’t perform that action at this time.
0 commit comments