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

Ignore path patterns #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

nmpowell
Copy link

Closes #7 closes #29 .

Changes the default behaviour of --ignore to also ignore directory names matching the pattern. I thought this would be the default behaviour, and apparently others did as well. You can revert to the original behaviour by adding the --include-directories flag. Thus for:

my_directory/
├── file1.txt
├── file2.txt
├── .hidden_file.txt
├── temp.log
└── subdirectory/
    └── file3.txt

files-to-prompt my_directory --ignore "sub*" will exclude file3.txt, files-to-prompt my_directory --ignore "sub*" --include-directories will not.

@nmpowell nmpowell marked this pull request as ready for review October 15, 2024 23:08
@DhruvParikh1
Copy link

Thank you for this; it will be especially useful for many projects with a "node_modules" directory (which contains a million subdirectories). I am assuming the command for that would be files-to-prompt . --ignore "node_modules*"?

Good work

@nmpowell
Copy link
Author

nmpowell commented Oct 16, 2024

I am assuming the command for that would be files-to-prompt . --ignore "node_modules*"?

Yes, just tested locally. "node_modules" (full name with or without *), "node*", "*modules", etc. No support afaict for the trailing slash, i.e. --ignore node_modules/ won't work. That's down to / not being output from os.walk.

Edit to add: For that matter, no path patterns with a slash, i.e. --ignore "node_modules/some_subdirectory" will work from this PR, because of how os.walk parses the tree. Only the standalone directory name.

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.

Can't find a way to ignore the node_modules directory not ignoring my venv folder
2 participants