list: show symlink targets (for tar and zip)#934
list: show symlink targets (for tar and zip)#934tommady wants to merge 9 commits intoouch-org:mainfrom
Conversation
Signed-off-by: tommady <tommady@users.noreply.github.com>
There was a problem hiding this comment.
Hey sorry for the eager review but what if is_dir and symlink_target get collapsed into one field for an enum for file type.
Regular and Directory unit variants
Symlink tuple variant with PathBuf inside.
so you express in the type system that symlink_target can't be some while is_dir is true.
wdyt
No worries at all, I agree this is a great idea. |
Signed-off-by: tommady <tommady@users.noreply.github.com>
Signed-off-by: tommady <tommady@users.noreply.github.com>
|
Hey @marcospb19, I added support for hard links in the tar archive as well. This goes slightly beyond the scope of the original issue, so feel free to let me know if you’d prefer to keep the change more minimal. For now, I made hard links display the same way as symlinks because I wasn’t sure what the best visual distinction would be (I’m definitely not a UI/UX designer 🤪). Whenever you have time, I’d appreciate a review. Thanks! |
src/list.rs
Outdated
| let _ = writeln!( | ||
| out, | ||
| "{}{}{} -> {}{}{}", |
There was a problem hiding this comment.
What if for hardlink we do:
A -> B (hardlink)
instead of
A -> B
To be explicit, I can't think of symbols that could replace the " (hardlink)" suffix
There was a problem hiding this comment.
what if we display hard links with =>
There was a problem hiding this comment.
not the best idea since only me and you would be able to tell that -> means symlink and => means hardlink.
specially assuming the user will see one or the other, usually, and not both, so they'll just assume it's a symlink I believe
There was a problem hiding this comment.
Since tar itself uses link to to represent hard links:
tar -tvf example.tar
drwxr-xr-x 1000/1000 0 2026-03-06 05:17 example
-rw-r--r-- 1000/1000 0 2026-03-05 08:42 example/hard_link
h--------- 0/0 0 1970-01-01 00:00 example/file link to example/hard_linkmaybe we could just stick with the same wording.
WDYT?
There was a problem hiding this comment.
Still prefer the -> symbol for symlinks and -> + (hardlink) :v sorry
Similar to what tree -a does in the CLI (the one I always download from pacman).
src/list.rs
Outdated
| FileType::Symlink { target } | FileType::Hardlink { target } => { | ||
| if is_running_in_accessible_mode() { | ||
| // Accessible mode: use "->" for screen readers | ||
| let _ = writeln!(out, "{} -> {}", name, target.display()); |
There was a problem hiding this comment.
Because we added ->, now ouch list can't be used in scripts to provide a file list 🤔 .
Can you add a check for, when --quiet is set but --tree isn't, we don't print out the arrow nor the target? This way you can still ouch list -q | xargs rm -i even if there is a symlink in it.
Let me know if you think there is a better and simpler approach, to allow for -> but keeping this compatible with scripts.
Signed-off-by: tommady <tommady@users.noreply.github.com>
Signed-off-by: tommady <tommady@users.noreply.github.com>
Signed-off-by: tommady <tommady@users.noreply.github.com>
Signed-off-by: tommady <tommady@users.noreply.github.com>
close: #932