Skip to content

Commit 9a2c665

Browse files
committed
formatting
1 parent 7f78c39 commit 9a2c665

File tree

1 file changed

+91
-91
lines changed

1 file changed

+91
-91
lines changed

lychee-lib/src/types/input.rs

+91-91
Original file line numberDiff line numberDiff line change
@@ -217,100 +217,100 @@ impl Input {
217217
skip_gitignored: bool,
218218
) -> impl Stream<Item = Result<PathBuf>> + '_ {
219219
try_stream! {
220-
match &self.source {
221-
InputSource::RemoteUrl(url) => {
222-
// For URLs, we just yield the URL string as a path
223-
yield PathBuf::from(url.to_string());
224-
},
225-
InputSource::FsGlob { pattern, ignore_case } => {
226-
// For glob patterns, we expand the pattern and yield matching paths
227-
let glob_expanded = tilde(pattern).to_string();
228-
let mut match_opts = glob::MatchOptions::new();
229-
match_opts.case_sensitive = !ignore_case;
230-
231-
for entry in glob_with(&glob_expanded, match_opts)? {
232-
match entry {
233-
Ok(path) => {
234-
// Skip directories or files that don't match extensions
235-
if path.is_dir() {
236-
continue;
237-
}
238-
if self.is_excluded_path(&path) {
239-
continue;
240-
}
241-
242-
// Check if it matches one of our file extensions
243-
if file_extensions_match(&path, &file_extensions) {
244-
yield path;
245-
}
246-
}
247-
Err(e) => {
248-
eprintln!("Error in glob pattern: {e:?}");
249-
continue;
250-
}
251-
}
252-
}
253-
},
254-
InputSource::FsPath(path) => {
255-
if path.is_dir() {
256-
// For directories, we walk through and yield matching files
257-
258-
259-
// In the get_file_paths method:
260-
for entry in WalkBuilder::new(path)
261-
// Enable or disable standard filters based on skip_gitignored parameter.
262-
// This controls:
263-
// - Hidden files/directories (skip files starting with '.')
264-
// - Parent directory gitignore rules
265-
// - .ignore files
266-
// - .gitignore files
267-
// - Global git ignore files
268-
// - .git/info/exclude files
269-
// When skip_gitignored is true, these filters are enabled (files will be skipped).
270-
// When skip_gitignored is false, these filters are disabled (all files will be included).
271-
.standard_filters(skip_gitignored)
272-
273-
// Override hidden file behavior to be controlled by the separate skip_hidden parameter
274-
.hidden(skip_hidden)
275-
276-
// Configure the file types filter to only include files with matching extensions
277-
.types(file_extensions.try_into()?)
278-
279-
.build()
280-
{
281-
let entry = entry?;
282-
if self.is_excluded_path(&entry.path().to_path_buf()) {
283-
continue;
284-
}
285-
match entry.file_type() {
286-
None => continue,
287-
Some(file_type) => {
288-
if !file_type.is_file() {
289-
continue;
290-
}
291-
}
292-
}
293-
294-
295-
yield entry.path().to_path_buf();
296-
}
297-
} else {
298-
// For individual files, yield if not excluded and matches extensions
299-
if !self.is_excluded_path(path) && file_extensions_match(path, &file_extensions) {
300-
yield path.clone();
301-
}
220+
match &self.source {
221+
InputSource::RemoteUrl(url) => {
222+
// For URLs, we just yield the URL string as a path
223+
yield PathBuf::from(url.to_string());
224+
},
225+
InputSource::FsGlob { pattern, ignore_case } => {
226+
// For glob patterns, we expand the pattern and yield matching paths
227+
let glob_expanded = tilde(pattern).to_string();
228+
let mut match_opts = glob::MatchOptions::new();
229+
match_opts.case_sensitive = !ignore_case;
230+
231+
for entry in glob_with(&glob_expanded, match_opts)? {
232+
match entry {
233+
Ok(path) => {
234+
// Skip directories or files that don't match extensions
235+
if path.is_dir() {
236+
continue;
237+
}
238+
if self.is_excluded_path(&path) {
239+
continue;
240+
}
241+
242+
// Check if it matches one of our file extensions
243+
if file_extensions_match(&path, &file_extensions) {
244+
yield path;
245+
}
246+
}
247+
Err(e) => {
248+
eprintln!("Error in glob pattern: {e:?}");
249+
continue;
250+
}
251+
}
252+
}
253+
},
254+
InputSource::FsPath(path) => {
255+
if path.is_dir() {
256+
// For directories, we walk through and yield matching files
257+
println!("Walking through directory: {}", path.display());
258+
259+
// In the get_file_paths method:
260+
for entry in WalkBuilder::new(path)
261+
// Enable or disable standard filters based on skip_gitignored parameter.
262+
// This controls:
263+
// - Hidden files/directories (skip files starting with '.')
264+
// - Parent directory gitignore rules
265+
// - .ignore files
266+
// - .gitignore files
267+
// - Global git ignore files
268+
// - .git/info/exclude files
269+
// When skip_gitignored is true, these filters are enabled (files will be skipped).
270+
// When skip_gitignored is false, these filters are disabled (all files will be included).
271+
.standard_filters(skip_gitignored)
272+
273+
// Override hidden file behavior to be controlled by the separate skip_hidden parameter
274+
.hidden(skip_hidden)
275+
276+
// Configure the file types filter to only include files with matching extensions
277+
.types(file_extensions.try_into()?)
278+
279+
.build()
280+
{
281+
let entry = entry?;
282+
if self.is_excluded_path(&entry.path().to_path_buf()) {
283+
continue;
284+
}
285+
match entry.file_type() {
286+
None => continue,
287+
Some(file_type) => {
288+
println!("Is file: {:?}", file_type.is_file());
289+
if !file_type.is_file() {
290+
continue;
302291
}
303-
},
304-
InputSource::Stdin => {
305-
// Stdin is handled specially - we yield a marker path
306-
yield PathBuf::from("stdin");
307-
},
308-
InputSource::String(_) => {
309-
// For raw strings, we yield a marker path
310-
yield PathBuf::from("string");
311-
},
292+
}
312293
}
294+
295+
yield entry.path().to_path_buf();
313296
}
297+
} else {
298+
// For individual files, yield if not excluded and matches extensions
299+
if !self.is_excluded_path(path) && file_extensions_match(path, &file_extensions) {
300+
yield path.clone();
301+
}
302+
}
303+
},
304+
InputSource::Stdin => {
305+
// Stdin is handled specially - we yield a marker path
306+
yield PathBuf::from("stdin");
307+
},
308+
InputSource::String(_) => {
309+
// For raw strings, we yield a marker path
310+
yield PathBuf::from("string");
311+
},
312+
}
313+
}
314314
}
315315

316316
/// Retrieve the contents from the input

0 commit comments

Comments
 (0)