@@ -9,9 +9,12 @@ use lscolors::{LsColors, Style};
9
9
not( feature = "nu-ansi-term" ) ,
10
10
not( feature = "gnu_legacy" ) ,
11
11
not( feature = "ansi_term" ) ,
12
- not( feature = "crossterm" )
12
+ not( feature = "crossterm" ) ,
13
+ not( feature = "owo-colors" )
13
14
) ) ]
14
- compile_error ! ( "one feature must be enabled: ansi_term, nu-ansi-term, crossterm, gnu_legacy" ) ;
15
+ compile_error ! (
16
+ "one feature must be enabled: ansi_term, nu-ansi-term, crossterm, gnu_legacy, owo-colors"
17
+ ) ;
15
18
16
19
fn print_path ( handle : & mut dyn Write , ls_colors : & LsColors , path : & str ) -> io:: Result < ( ) > {
17
20
for ( component, style) in ls_colors. style_for_path_components ( Path :: new ( path) ) {
@@ -32,6 +35,12 @@ fn print_path(handle: &mut dyn Write, ls_colors: &LsColors, path: &str) -> io::R
32
35
let ansi_style = style. map ( Style :: to_crossterm_style) . unwrap_or_default ( ) ;
33
36
write ! ( handle, "{}" , ansi_style. apply( component. to_string_lossy( ) ) ) ?;
34
37
}
38
+ #[ cfg( feature = "owo-colors" ) ]
39
+ {
40
+ use owo_colors:: OwoColorize ;
41
+ let ansi_style = style. map ( Style :: to_owo_colors_style) . unwrap_or_default ( ) ;
42
+ write ! ( handle, "{}" , component. to_string_lossy( ) . style( ansi_style) ) ?;
43
+ }
35
44
}
36
45
writeln ! ( handle) ?;
37
46
0 commit comments