Highlight btrfs subvolumes and mount points; output mount point info #452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: #434
I don't expect you to pull this straight in; I'm not a Rust developer so a lot of this code probably isn't very Rust-y and will need error handling and fixups.
That said, I've tested locally and it does what I think it should: identifies
btrfs
subvolumes and highlights them with the^
character in the first column (list view) and funky colouring. Mount points are also underlined in all views and in list view include an arrow->
pointing to the device name and filesystem type. That would probably be better as an option, of course.The code for looking up mount points was borrowed from https://github.com/acdha/mountstatus/tree/master/src/get_mounts and expanded to get the fs type and device name. It would be nice to also get the mount options because the mount point alone isn't very useful for btrfs at least. Also, I don't have a non-Linux system to test on so
bsd.rs
is almost certainly broken.There's also the case that a directory could be both a mount point and a subvolume - i.e. a btrfs subvolume is mounted at that point. I'd like to highlight that in the colouring somehow but couldn't think of a good way to do it (background and underline maybe). Likewise, first character in list view would be nice to have different for mount points. Perhaps it would be possible to do something funky with colours.
Comments welcome.