Canop/dysk

[enhancement] allow further configuration of the output columns

simonbcn opened this issue · 10 comments

I use lfs to monitor the free space on my hard disks. IMHO there is information that this command shows that for most users is not necessary and only takes up space.

$ lfs
┌───┬─────┬──────────────┬────┬────┬────┬─────────┬────┬────┬────────────┐
│ id│ dev │  filesystem  │disk│type│used│  use%   │free│size│mount point │
├───┼─────┼──────────────┼────┼────┼────┼─────────┼────┼────┼────────────┤
│140│8:1  │/dev/sda1     │HDD │xfs │7.6T│42% ██▏  │ 10T│18T │/multimedia │
│145│8:17 │/dev/sdb1     │HDD │xfs │5.4T│33% █▋   │ 11T│16T │/multimedia2│
│ 62│259:2│/dev/nvme0n1p2│SSD │f2fs│384G│19% █    │1.6T│2.0T│/           │
│ 87│259:1│/dev/nvme0n1p1│SSD │vfat│59M │22% █▏   │209M│268M│/boot       │
└───┴─────┴──────────────┴────┴────┴────┴─────────┴────┴────┴────────────┘

I would like to be able to obtain something like this output:

┌──────────────┬────┬─────────┬────┬────┬────────────┐
│ filesystem   │used│  use%   │free│size│mount point │
├──────────────┼────┼─────────┼────┼────┼────────────┤
│/dev/sda1     │7.6T│42% ██▏  │ 10T│18T │/multimedia │
│/dev/sdb1     │5.4T│33% █▋   │ 11T│16T │/multimedia2│
│/dev/nvme0n1p2│384G│19% █    │1.6T│2.0T│/           │
│/dev/nvme0n1p1│59M │22% █▏   │209M│268M│/boot       │
└──────────────┴────┴─────────┴────┴────┴────────────┘

Including being able to change the order of the columns.

Canop commented

I can do that. This would probably be with a verbose launch argument like --columns fs,used,use-percent,free,size,mount-point but I imagine all people interested would only do that with an alias

what about adding --compact to accomplish this? It should only print the bare minimum to list drives and volumes as used in the example by @simonbcn

Canop commented

@daniejstriata Problem is there can be very different opinions about what's the useful compact set. I might allow a few standard sets. Right now I'm thinking about using the syntax I defined for rhit fields selection, allowing an explicit set, or additions or removals to a standard one: https://dystroy.org/rhit/usage-fields/

@Canop That sounds good.

Canop commented

And I'll have to build a documentation site because the README will start to be too hard to read. Suggestions for what to include on the site, or other needed parameters are welcome (chat is good for that).

Canop commented

@simonbcn @daniejstriata I've started a GH discussion on this topic: #29

Canop commented

Done in lfs 2. See doc: https://dystroy.org/lfs/table/

Thank you very much, I just tried it and the only thing is that the filesystem is not aligned to the left:

$ lfs
┌──────────────┬────┬────┬────┬─────────┬────┬────┬────────────┐
│  filesystem  │disk│type│used│  use%   │free│size│mount point │
├──────────────┼────┼────┼────┼─────────┼────┼────┼────────────┤
│  /dev/sda1   │HDD │xfs │6.8T│38% █▉   │ 11T│ 18T│/multimedia │
│  /dev/sdb1   │HDD │xfs │9.0T│56% ██▊  │7.0T│ 16T│/multimedia2│
│/dev/nvme0n1p2│SSD │f2fs│364G│18% ▉    │1.6T│2.0T│/           │
│/dev/nvme0n1p1│SSD │vfat│ 89M│33% █▋   │180M│268M│/boot       │
└──────────────┴────┴────┴────┴─────────┴────┴────┴────────────┘
Canop commented

Damn... Didn't notice this...

I'll release a new version ^^

Canop commented

Done. version 2.0.1.