Skip to content
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

Other unit names #47

Closed
franciscop opened this issue Apr 21, 2018 · 3 comments
Closed

Other unit names #47

franciscop opened this issue Apr 21, 2018 · 3 comments

Comments

@franciscop
Copy link

Some command line in Linux like lsblk will return the units with M or G instead of MB or GB. While I can simply append a 'B' to the string and call it a day, it'd be nice if this library did that by default. I can do a PR, since this should be a fairly easy fix. Example of what I'm talking about:

NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                       8:0    0 238,5G  0 disk  
├─sda1                    8:1    0   512M  0 part  /boot/efi
├─sda2                    8:2    0   488M  0 part  /boot
└─sda3                    8:3    0 237,5G  0 part  
  └─sda3_crypt          252:0    0 237,5G  0 crypt 
    ├─ubuntu--vg-root   252:1    0 229,6G  0 lvm   /
    └─ubuntu--vg-swap_1 252:2    0   7,9G  0 lvm   [SWAP]
sdb                       8:16   1  29,7G  0 disk  
└─sdb1                    8:17   1  29,7G  0 part  /media/francisco/3836-3934
@dougwilson
Copy link
Contributor

I don't think this module would parse the value 238,5GB though, right?

@bato3
Copy link

bato3 commented Jul 6, 2018

Apart from the discussion in #26, I am asking for adding support for prefixes MiB, GiB, ...

@franciscop you also should change coma, to dot. as decimal separator

@franciscop
Copy link
Author

I ended up parsing sudo fdisk -l /dev/sda1 which gives the exact bytes (which is also more precise) for information. I am using this library in reverse now, from bytes to MB/GB, so thanks for creating the library!

I'll close it since it seems an edge case (M === MB), feel free to reopen if this is still valuable.

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

No branches or pull requests

3 participants