Comments (4)
Or you could apply the fallback when you construct the
LsColors
object. Or wait until you're actually coloring a file to apply it.
The problem is that those fields are currently public. They were intended for users of this library that don't want to rely on one of the provided methods (like style_for_path
) but rather implement their own logic and just use this library as a parser for LS_COLORS
. Another reason was that, in principle, users could also overwrite certain styles after constructing the LsColors
object from the environment variable.
from lscolors.
Thank you for the detailed report. This should be fixed. I misinterpreted (or rather: didn't really know) what mi
represents.
My understanding of the semantics is that
or
(orphan) is for broken links, andmi
(missing) is for files that don't exist.
I can reproduce this. You are right.
Additionally,
mi
falls back toor
ifmi
is not set, soLS_COLORS='or=31;01:'
results in both getting the redor
color.
This is interesting, because it probably requires me to rethink the API of lscolors
a little bit. It currently exposes LsColors::broken_symlink: Option<Style>
as a field, but if there are fallbacks, we probably need functions (like LsColors::missing_style() -> Option<Style>
) that implement the necessary fallback logic.
Finally, setting a key (besides
rs
) to a string containing only zeros is the same as having it unset, so
LS_COLORS='or=31;01:mi=00:
keeps everything red.
I'm not sure if
lscolors
tries to color links differently than link targets, but regardless,mi=00:
shouldn't be overwriting theor
color.
Yes, absolutely. For the lscolors
library, there should be a way to get the style for both "orphan" and "missing". For the lscolors
binary, we could print broken symlinks as "orphan" and print any non-existing path as "missing".
from lscolors.
This is interesting, because it probably requires me to rethink the API of
lscolors
a little bit. It currently exposesLsColors::broken_symlink: Option<Style>
as a field, but if there are fallbacks, we probably need functions (likeLsColors::missing_style() -> Option<Style>
) that implement the necessary fallback logic.
Or you could apply the fallback when you construct the LsColors
object. Or wait until you're actually coloring a file to apply it.
from lscolors.
The main issue has been resolved in #12.
I have opened two new tickets #13 and #14 for the remaining issues (fallback from mi => or, reset via zero).
from lscolors.
Related Issues (20)
- Clear up documentation on loading LSCOLORS env var HOT 1
- ls has default styles HOT 1
- Release v0.5.0 is missing the non-musl .deb package HOT 1
- Unsupported ANSI codes should be ignored
- Support for `tui-rs`? HOT 1
- Windows support? HOT 19
- [feature request] API to style file paths that don't exist on disk HOT 6
- Feature request: Always add ANSI coloring sequence, HOT 1
- Feature request: option to return a substring of the colored file name HOT 1
- Release a new version for the support of crossterm HOT 1
- Support for bright/light colors HOT 1
- Crossterm conversion using incorrect colors HOT 2
- Generate ls_colors from file_type() call HOT 4
- Tracking issue for incompatibilities with GNU ls HOT 5
- support crossterm 0.24 with it's new underline styles HOT 2
- Support LSCOLORS env variable on macOS HOT 6
- Released a new version? HOT 2
- README doesn't explain how to build the command-line application HOT 3
- option to set "root" path HOT 6
- "-n" input ignore
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lscolors.