Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow globs to be passed into yek #111

Merged
merged 6 commits into from
Feb 23, 2025
Merged

feat: allow globs to be passed into yek #111

merged 6 commits into from
Feb 23, 2025

Conversation

mohsen1
Copy link
Collaborator

@mohsen1 mohsen1 commented Feb 23, 2025

e.g. yek *.rs

Expanded glob patterns into file and directory lists before processing.

Added process_files_parallel_internal to handle directory recursion separately.
- Add test_glob_pattern_single_file to verify single file matching

- Add test_glob_pattern_multiple_files to test multiple file matching

- Add test_glob_pattern_nested_directories to test recursive glob patterns

- Add test_glob_pattern_no_matches to verify empty result handling

- Fix relative path comparisons in tests
- Fix String::from_utf8 call in test_output_dir to properly handle ownership

- Fix glob pattern handling in test_glob_pattern by using current_dir

- Fix directory handling in test_mix_of_files_and_dirs by using current_dir

- Fix glob pattern and directory handling in test_mix_of_files_and_dirs_with_glob_pattern
@mohsen1 mohsen1 marked this pull request as ready for review February 23, 2025 00:39
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds glob pattern support to the yek tool, enabling file selection using patterns like *.rs for more flexible file matching.

  • Added glob pattern expansion in src/parallel.rs with proper handling for single files, directories, and multiple patterns
  • Introduced comprehensive test coverage in tests/e2e_test.rs for glob pattern matching scenarios
  • Added test cases in tests/parallel_test.rs for nested directory traversal and edge cases
  • Changed String::from_utf8_lossy to String::from_utf8 in test code for more explicit error handling
  • Split directory processing logic in process_files_parallel for better maintainability

4 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

mohsen1 and others added 3 commits February 23, 2025 07:46
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Add glob pattern support to feature list

- Add examples for using glob patterns and individual file selection

- Include note about quoting glob patterns to prevent shell expansion
@mohsen1 mohsen1 added this pull request to the merge queue Feb 23, 2025
Merged via the queue into main with commit 5037fb4 Feb 23, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant