Option to output colored file name only
Given "aaa/bbb/entry" return only "color + entry + color reset".
Use case:
I have "$HOME/downloads", which happens to be a link, and a lot of other files from different directories in a list and want to colorize them.
The only way to get correct colorization is to be in the right directory for each entry in the list, this means starting a process for each entry and is prohibitively expensive.
I can send the full path but then I'd have to parse the colored string.
An alternative would be to output the colored path and the colored entry on different lines.
Isn't this the same as https://github.com/sharkdp/lscolors/issues/70?
@sharkdp
They are different.
issue 70
Add a user defined $root to every input entry
issue 78
output only the colored basename without the path
orthogonality
a list of files could be passed as arguments with --root $root to be added to the files and --name-only would only return the basename of the file colored according to the file present int $root (ie could exist and be executable in $root).
You can do this with bfs:
$ bfs -color -prune -printf '%f\n' path/to/file1 path/to/file2
file1
file2
@tavianator I would but
positive: bfs is faster than lscolors negative: bfs doesn't accepted files on stdin which is a show stopper for me
If you can \0-separate them instead of \n, then it does support -files0-from -. If not, there's always xargs :)
@tavianator
I didn't get that far in the man page.
I'll probably end up writing a wrapper called 'lscolors' around 'bfs' till I find the time to replace it, I just found out that I use lscolors in 25 different places in my code!
See #80 for some changes related to this ticket.