lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Extract a symlink's target type if possible, so it can have proper colors.

Open dsully opened this issue 4 years ago • 7 comments
trafficstars

Extract a symlink's target type if possible, so it can have proper colors.

Before: CleanShot 2021-10-08 at 11 12 14@2x

After:

CleanShot 2021-10-08 at 11 11 43@2x
  • [X] Use cargo fmt
  • [X] Add necessary tests
  • [X] Add changelog entry

dsully avatar Oct 08 '21 18:10 dsully

Codecov Report

Merging #563 (ea64953) into master (74c1206) will decrease coverage by 0.35%. The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #563      +/-   ##
==========================================
- Coverage   86.73%   86.38%   -0.36%     
==========================================
  Files          37       37              
  Lines        3800     3819      +19     
==========================================
+ Hits         3296     3299       +3     
- Misses        504      520      +16     
Impacted Files Coverage Δ
src/meta/symlink.rs 55.84% <20.00%> (-13.13%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 74c1206...ea64953. Read the comment docs.

codecov-commenter avatar Oct 08 '21 18:10 codecov-commenter

oh, my bad, I got you wrong! could you add some tests for this feature and we can pass the CI

zwpaper avatar Oct 09 '21 12:10 zwpaper

Hey, what sort of tests would you like? Since it's pretty much just pattern matching.

dsully avatar Oct 09 '21 13:10 dsully

We should probably colors the items using lscolors and not just builtin colors.

meain avatar Oct 09 '21 15:10 meain

@meain the coloring is using the default mechanism, it would already use the LSCOLOR if I get the coloring logic right.

zwpaper avatar Oct 10 '21 14:10 zwpaper

Ahh, my bad I misread what the code was doing.

@dsully I found a small issue in the code. If the symlink is relative and we are not calling lsd from the same directory that it was symlinked from, it does not work.

cd /tmp
mkdir -p test/{a,b}
cd test
touch a/file
cd b
ln -s ../a/file file
cd ..
lsd -ld b/file

meain avatar Oct 10 '21 14:10 meain

Ok, I'll take a look.

dsully avatar Oct 12 '21 17:10 dsully