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

Add support for enumerations like LICENSE{.md,.txt} #4

Open
sharkdp opened this issue Nov 19, 2018 · 5 comments
Open

Add support for enumerations like LICENSE{.md,.txt} #4

sharkdp opened this issue Nov 19, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@sharkdp
Copy link
Owner

sharkdp commented Nov 19, 2018

instead of having to add

- LICENSE
- LICENSE.txt
- LICENSE.md

it would be nice if we could write something like

- LICENSE{,.txt,.md}
@sharkdp sharkdp added the enhancement New feature or request label Dec 3, 2018
@gseidler
Copy link
Contributor

gseidler commented Feb 11, 2019

It would be nice if there was a way to recognize wildcards like *rc for .bashrc, .vimrc, .zshrc, .r[0-9]{0,2} for segmented rar files and also a way to differentiate dotfiles and file extensions. Thanks for the great work!

@sharkdp
Copy link
Owner Author

sharkdp commented Feb 11, 2019

Unfortunately, we are limited by the way that LS_COLORS patterns work. They are always of the form *suffix and match on everything that ends with suffix. There is no other kind of pattern.

  • *.txt matches all file names that end with .txt (good!)
  • *LICENSE matches a file named LICENSE (good), but also files named MIT-LICENSE (okay, I guess)
  • *rc matches files named .bashrc, .vimrc, etc. (good), but also a file named porc or whatever.arc (:frowning:)

Given this limitation, we are forced to make our patterns as specific as possible. Otherwise, we'll get a lot of false matches.

@gseidler
Copy link
Contributor

I understand. I've been using trapd00r's LS_COLORS and he has a lot of those. He also has a few interesting tricks there for segmented file extensions.

@sharkdp
Copy link
Owner Author

sharkdp commented Feb 11, 2019

Thank you very much for the hint. I'm very open to adding a lot more file extensions patterns. trapd00r's LS_COLORS project is definitely a great inspiration (see also the reference in the README)

@rivy
Copy link

rivy commented Nov 13, 2022

The first ask - LICENSE{,.md,.txt} could be accomplished by simple brace expansion of the text from the vivid filetypes configuration file into multiple arguments... LICENSE, LICENSE.md and LICENSE.txt.

It could make the filetypes.yml configuration tidier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants