Add --hide-fs to hide specific fs types - #38
Conversation
| if len(fs) == 0 { | ||
| continue | ||
| } | ||
| hideMap[fs] = struct{}{} |
There was a problem hiding this comment.
Might be worth ensureing the inputted filetypes are converted to lowercase: e.g.
| hideMap[fs] = struct{}{} | |
| hideMap[strings.ToLower(fs)] = struct{}{} |
There was a problem hiding this comment.
Not pretty sure whether this value is case-sensitive.
https://man7.org/linux/man-pages//man5/fs.5.html
FILESYSTEMS(5) Linux Programmer's Manual FILESYSTEMS(5) NAME filesystems - Linux filesystem types: ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sysv, umsdos, vfat, XFS, xiafs,
It seems like fs types are case-sensitive according to the description.
But I'm confused now, since a XFS filesystem shows xfs in Fstype, but on that man page it says XFS.
There was a problem hiding this comment.
Did you come to a conclusion here? Personally I think I agree, purely because users shouldn't be required to type XFS or JFS (all uppercase) on the command-line. This would probably cause a bunch of confusion, especially if the filtering doesn't apply silently: there wouldn't be an error or any indication that lowercase vs uppercase makes a difference here.
There was a problem hiding this comment.
After an experiment, I found out that the value of Fstype is case-sensitive. I've managed to create a mount point, with upper-case letter in its type name, by using hello example in libfuse. And this is how I tested:
- build hello example
- rename the output binary to
Hello - execute
./Hello /mnt, or any other mount point
Then duf --all shows:
...
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├──────────────────────────┼──────┼──────┼───────┼──────┼────────────────────────┼───────────────────┤
│ /mnt │ 0B │ 0B │ 0B │ │ fuse.Hello │ Hello │
...
I think it should not be a problem to make --hide-fs a case-sensitive flag. In a general scenario, user would specify --hide-fs after finding out there are too much unnecessary mount points listed, which means the actual type name is already printed on screen clearly.
muesli
left a comment
There was a problem hiding this comment.
Nice work, almost there! Just a few tiny changes I'd appreciate.
| if len(fs) == 0 { | ||
| continue | ||
| } | ||
| hideMap[fs] = struct{}{} |
There was a problem hiding this comment.
Did you come to a conclusion here? Personally I think I agree, purely because users shouldn't be required to type XFS or JFS (all uppercase) on the command-line. This would probably cause a bunch of confusion, especially if the filtering doesn't apply silently: there wouldn't be an error or any indication that lowercase vs uppercase makes a difference here.
Solves #12
Example: