-
-
Notifications
You must be signed in to change notification settings - Fork 418
Add --hide-fs to hide specific fs types #38
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
Conversation
if len(fs) == 0 { | ||
continue | ||
} | ||
hideMap[fs] = struct{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: