File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: parser:: Extractor ;
2
2
use crate :: scanner:: detect_sources:: DetectSources ;
3
+ use bexpand:: Expression ;
3
4
use bstr:: ByteSlice ;
4
5
use fxhash:: { FxHashMap , FxHashSet } ;
5
6
use glob:: fast_glob;
@@ -217,6 +218,26 @@ impl Scanner {
217
218
return ;
218
219
}
219
220
221
+ // Expand glob patterns and create new `GlobEntry` instances for each expanded pattern.
222
+ let sources = sources
223
+ . iter ( )
224
+ . flat_map ( |source| {
225
+ let expression: Result < Expression , _ > = source. pattern [ ..] . try_into ( ) ;
226
+ let Ok ( expression) = expression else {
227
+ return vec ! [ source. clone( ) ] ;
228
+ } ;
229
+
230
+ expression
231
+ . into_iter ( )
232
+ . filter_map ( |expanded_pattern| expanded_pattern. map ( |x| x. into ( ) ) . ok ( ) )
233
+ . map ( move |pattern| GlobEntry {
234
+ base : source. base . clone ( ) ,
235
+ pattern,
236
+ } )
237
+ . collect :: < Vec < _ > > ( )
238
+ } )
239
+ . collect :: < Vec < _ > > ( ) ;
240
+
220
241
// Partition sources into sources that should be promoted to auto source detection and
221
242
// sources that should be resolved as globs.
222
243
let ( auto_sources, glob_sources) : ( Vec < _ > , Vec < _ > ) = sources. iter ( ) . partition ( |source| {
You can’t perform that action at this time.
0 commit comments