@@ -60,12 +60,22 @@ impl TerminalColours {
60
60
}
61
61
62
62
63
- pub struct Style {
63
+ /// **Styles**, which is already an overloaded term, is a pair of view option
64
+ /// sets that happen to both be affected by `LS_COLORS` and `EXA_COLORS`.
65
+ /// Because it’s better to only iterate through that once, the two are deduced
66
+ /// together.
67
+ pub struct Styles {
68
+
69
+ /// The colours to paint user interface elements, like the date column,
70
+ /// and file kinds, such as directories.
64
71
pub colours : Colours ,
72
+
73
+ /// The colours to paint the names of files that match glob patterns
74
+ /// (and the classify option).
65
75
pub style : FileStyle ,
66
76
}
67
77
68
- impl Style {
78
+ impl Styles {
69
79
70
80
#[ allow( trivial_casts) ] // the "as Box<_>" stuff below warns about this for some reason
71
81
pub fn deduce < V , TW > ( matches : & MatchedFlags , vars : & V , widther : TW ) -> Result < Self , Misfire >
@@ -80,7 +90,7 @@ impl Style {
80
90
81
91
let tc = TerminalColours :: deduce ( matches) ?;
82
92
if tc == Never || ( tc == Automatic && widther ( ) . is_none ( ) ) {
83
- return Ok ( Style {
93
+ return Ok ( Styles {
84
94
colours : Colours :: plain ( ) ,
85
95
style : FileStyle { classify, exts : Box :: new ( NoFileColours ) } ,
86
96
} ) ;
@@ -101,14 +111,14 @@ impl Style {
101
111
LSColors ( exa. as_ref ( ) ) . each_pair ( |pair| {
102
112
colours. set_exa ( & pair) ;
103
113
} ) ;
114
+ let style = FileStyle { classify, exts } ;
115
+ Ok ( Styles { colours, style } )
104
116
}
105
117
106
118
let classify = Classify :: deduce ( matches) ?;
107
119
let exts = if colours. colourful { Box :: new ( FileExtensions ) as Box < _ > }
108
120
else { Box :: new ( NoFileColours ) as Box < _ > } ;
109
121
110
- let style = FileStyle { classify, exts } ;
111
- Ok ( Style { colours, style } )
112
122
}
113
123
}
114
124
0 commit comments