compsize icon indicating copy to clipboard operation
compsize copied to clipboard

Add option to set fixed output format for size or at least raw bytes

Open MurzNN opened this issue 4 years ago • 1 comments

Sometimes very useful to see all size values in same measurement, for example in megabytes. Also for parsing output in scripts will be good to have a raw bytes output for all sizes. For example, in btrfs filesystem df we can choose format via cli arguments:

# btrfs filesystem df --help
usage: btrfs filesystem df [options] <path>

    Show space usage information for a mount point

    -b|--raw           raw numbers in bytes
    -h|--human-readable
                       human friendly numbers, base 1024 (default)
    -H                 human friendly numbers, base 1000
    --iec              use 1024 as a base (KiB, MiB, GiB, TiB)
    --si               use 1000 as a base (kB, MB, GB, TB)
    -k|--kbytes        show sizes in KiB, or kB with --si
    -m|--mbytes        show sizes in MiB, or MB with --si
    -g|--gbytes        show sizes in GiB, or GB with --si
    -t|--tbytes        show sizes in TiB, or TB with --si

Can you please add this feature? Thanks!

MurzNN avatar Sep 03 '21 16:09 MurzNN

-b/--bytes is already there, which should be enough for scripts.

As for forcing a larger unit, that'd be reasonable, but I'm quite out of tuits these days.

kilobyte avatar Sep 13 '21 11:09 kilobyte