File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,10 @@ impl App {
207
207
|| match self . matches . get_one :: < String > ( "color" ) . map ( |s| s. as_str ( ) ) {
208
208
Some ( "always" ) => true ,
209
209
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
+ }
211
214
_ => unreachable ! ( "other values for --color are not allowed" ) ,
212
215
} ,
213
216
paging_mode,
Original file line number Diff line number Diff line change @@ -19,11 +19,12 @@ static VERSION: Lazy<String> = Lazy::new(|| {
19
19
} ) ;
20
20
21
21
pub 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
+ } ;
27
28
28
29
let mut app = Command :: new ( crate_name ! ( ) )
29
30
. version ( VERSION . as_str ( ) )
You can’t perform that action at this time.
0 commit comments