colorls
colorls copied to clipboard
Icons for file with only one extension
- Relevant Issues : (none)
- Relevant PRs : (none)
- Type of issue :
- [ ] Installation
- [x] Font-related
- [ ] Feature request
- [ ] Bug in existing feature
- [ ] Developer mode : Code quality / Tests / Documentation
Hello, the colorls in my machine can't recognize file with only one extension such as .ignore
, .DS_Store
,.type_example
, here is an example:
The file .DS_Store
and .gitignore
are recognized as file
type instead of apple
/ git
type. I changed nothing in yaml
dir.(I also tried adding ds_store:"\ue711"
, and it didn't work.)
If I add any latters before dot, it can recognize rightly. For example, I renamed .gitignore
to test.gitignore
,it showed as follow:
Other files with name before dot can be recognized correctly. My system is macOS 10.15.7, and I have installed nerd-font.
Thank you for reading.
Thanks for the bug report!
The problem is that the files you mentioned do not have an extension.
For example, .gitignore
is a hidden file, which is denoted by the leading dot, but by there is no file extension.
We would need to change the implementation that we no longer recognise files by extension, but rather using a suffix match, such that if one wanted to specify a icon for a file with an extension you would have to include the dot in the pattern.
Thank you for replying.
I tried adding .DS_Store: apple
in the file file_aliases.yaml
before and didn't work, wondering how to realize if one wanted to specify an icon for a file with an extension you would have to include the dot in the pattern
.
I noticed in README.md
, the colorls can recognize the files that do not have an extension like .gitignore
and .DS_Store
, I just wondering how does it work, do I need to change something in file_aliases.yaml
or file.yaml
?
My English is not so good, thank you for reading :)
You are right, it used to work in older versions, but I broke it in commit https://github.com/athityakumar/colorls/commit/17b2142c48ac6cd760532116c0e483085caaea2c while fixing #441.
(In my defence, there were no unit tests assuring this works the way it did)
Got it, thank you for replying :)
Why did you close this? This is a valid issue that is supposed to work!
Sorry, I thought after the commit 17b2142c48ac6cd760532116c0e483085caaea2c colorls won't bring this feature back again, my mistake , ಠ_ಠ
Hi, would a code snippet like this here :
extension = File.extname(content.name).delete_prefix(".")
basename = File.basename(content.name, ".*").delete_prefix(".")
key = extension.empty? ? basename : extension
key = key.downcase.to_sym
solve this issue ? This might also solve #459 I have never done any ruby before so this might not be optimised / up to standard etc, but it seems to work on online compiler environments