lsd-rs / lsd

The next gen ls command
Apache License 2.0
12.85k stars 420 forks source link

color of symbolic link and color + icon of link target #1010

Open thranduil79 opened 4 months ago

thranduil79 commented 4 months ago

hi,

i am using lsdeluxe for years now (thank you).

as an excercise, i have started to reprogram lsd in c by using lsd's output as a reference. having gone into details, i have noticed, that gnu ls is showing more information than lsd when it comes to links. from lsd, i kinda would have expected the output of my own solution, see the screenshots below.

as far as i understand, this is the same topic like this isue 760..

you can find my project here. it should compile on linux without any dependencies other than the gnu libraries. mind it is a work in progress.

Expected behaviour on linux from lsd

(i have worded out the screen shots below, probably rather useless, but i tried to follow the form.)

(red) [link icon] dead link --> (red) [icon] dangling link target (bold green) [dir link icon] link to dir --> (bol blue) [dir icon] link target dir (bold green) [dir link icon] link to public dir --> (blue on green) [dir icon] link target dir (bold green) [file link icon] link to file --> (color according to file extension) [file icon] link target file (bold green) [file link icon] link to pipe --> (orange?) [pipe icon] link target pipe (bold green) [file link icon] link to socket --> (bold magenta?) [pipe socket] link target socket (bold green) [file link icon] link to char device --> (bold yellow) [char dev icon] link target character device

Actual behaviour on linux of lsd

(bold green) [icon] dead link --> (white) [no icon] dagling link target (bold green) [dir or file icon] any other symbolic link --> (bold green) [no icon] any other link target

Comparison of screenshots of gnu ls, lsd and my implementation for some test files on linux

below is an example for the listing of my test symbolic links.

please ignore the "_private_dir" and "_public_dir" entries.

lsdeluxe

any symbolic link has the "dark green" link color. the information content is hence lower than the one of the gnu ls.

image

my own implementation

the symbolic link and the link target have the "correct color", and the link and the link target show the "correct" icon.

in order to add more information to the listing, i have colored the 'l' at the start of the line in accordance with the color of the link target.

note that the "Wood.bmp" is not supposed to be white and the icon is the generic "file icon". i have not yet implemented neither the color nor the icon based on file extensions.

image

gnu ls

the symbolic link and the link target have the "correct color".

image

kakulukia commented 2 months ago

I would even go a step further and add "[Dead link]" as colorls does it:

image

Or at least have the option to color it read when the link is dead. There is a links invalid option mentioned for colors.yaml https://github.com/lsd-rs/lsd?tab=readme-ov-file#color-theme-file-content But its not working for me. :/