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

Enhancement: Unify exclude/include #118

Closed
pykong opened this issue Feb 19, 2020 · 2 comments · Fixed by #128
Closed

Enhancement: Unify exclude/include #118

pykong opened this issue Feb 19, 2020 · 2 comments · Fixed by #128
Milestone

Comments

@pykong
Copy link
Collaborator

pykong commented Feb 19, 2020

The readme states:

# Shell-style patterns files/folders that must not be copied.
_exclude:
  - "*.bar"
  - ".git"
  - ".git/*"

# Shell-style patterns files/folders that *must be* copied, even if
# they are in the exclude list
_include:
  - "foo.bar"

Probably it would be better to just have a single setting exclude but enhance it with a negating syntax that would allow to specify paths to include nonetheless. Maybe we could take gitignores syntax as an inspiration here. A leading ! will make a path non-ignored. See: https://git-scm.com/docs/gitignore#_examples

I have found the following libraries which mplement the kind of pattern matching we are looking for:

@pykong
Copy link
Collaborator Author

pykong commented Feb 25, 2020

@yajo I can implement this.
The package pathspec works like a breeze. :-)
However, it does not yet feature unicode support. Hence files like ñana.txt would never get excluded, because of their special char.

I assume for you, as well as other Spanish speaking users such unicode support is absolutely vital?

EDIT: It seems I can make it work anyway. The unicode issues might stem from somewhere outside pathspec, namely I have messed up the tests because my editor does not properly render those symbols.

@yajo
Copy link
Member

yajo commented Feb 26, 2020

I like the idea of this PR, and also using a good lib that handles this transparently, but yes it should support unicode. Otherwise it's a regression.

Another idea is to use regexps, but that's maybe not as comfortable as a proper glob system. pre-commit uses regexs, in case it matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants