Skip to content

feat: enhance --mounts: display mount root path #1463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vlad20012
Copy link

@vlad20012 vlad20012 commented Apr 21, 2025

The path of mount root is now printed in square brackets next to a mount source, similar
to findmnt command output. The root is not displayed if it equals to /.

Example:

mkdir /foo && mkdir /bar;
mount --bind /bar /foo
eza -l --mounts /
# /bar
# /foo [/dev/sda1[/bar] (ext4)]
# ...
findmnt /foo
# /foo /dev/sda1[/bar] ext4   rw,relatime,errors=remount-ro

This is useful for mount --bind as well as for mounts of non-default btrfs subvolumes.
Linux only.

@vlad20012 vlad20012 changed the title Enhance --mounts: display mount root path feat: enhance --mounts: display mount root path Apr 21, 2025
@vlad20012 vlad20012 force-pushed the mount-root branch 2 times, most recently from 2ade1e8 to 2702e78 Compare April 22, 2025 09:14
Copy link
Member

@cafkafk cafkafk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is pretty cool. One thing I do think would be nice before merge is if the mounts would be aligned on the grid (and respect the --header flag as well). Currently, the mounts are unaligned.

E.g. see:

$ eza -l / --mounts --header --no-permissions --no-user --no-filesize --no-time
Name
bin
boot [/dev/nvme0n1p1 (vfat)]
dev [devtmpfs (devtmpfs)]
etc
home [zpool/home (zfs)]
lib
lib64
mnt
nix [zpool/nix (zfs)]
opt
proc [proc (proc)]
root
run [tmpfs (tmpfs)]
rustup
srv
sys [sysfs (sysfs)]
tmp [tmpfs (tmpfs)]
usr
var [zpool/var (zfs)]

The path of root is printed in square brackets next to a mount source, similar
 to `findmnt` command output. The root is not displayed if it equals to `/`.

Example:
```
mkdir /foo && mkdir /bar;
mount --bind /bar /foo
eza -l --mounts /
# /bar
# /foo [/dev/sda1[/bar] (ext4)]
# ...
findmnt /foo
# /foo /dev/sda1[/bar] ext4   rw,relatime,errors=remount-ro
```

This is useful for `mount --bind` as well as for mounts of non-default btrfs subvolumes.
@vlad20012
Copy link
Author

vlad20012 commented May 1, 2025

@cafkafk I agree, indeed it would be much better if mounts are aligned. But I don't add mounts in this PR. They were added in #167, and they was unaligned there. So I believe alignment should be done in a separate PR.

@vlad20012
Copy link
Author

@cafkafk Oh wait, after some thought, it began to seem to me that mount are rather similar to symlik destinations. And symlinks destinations seems not aligned in both ls -l and eza.

image

So, do you really think mounts should be aligned regardless?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants