feat: add configurable binary disk capacity units (#2236)

Enable binary disk capacity units with:

```toml
[disk]
use_binary_prefix = true
```

Or pass `--disk_use_binary_prefix` (alias `--disk-use-binary-prefix`). The CLI flag takes precedence over a false config setting. Decimal units remain the default.

Used, Free, and Total use the existing binary conversion helper. For example, 536,870,912,000 bytes changes from `537GB` to `500GiB`. Percentages, sorting by raw byte values, I/O rates, and network units retain their existing behavior.

The change passes the option from argument/config parsing through application settings and collected disk data to cell formatting. Four regression tests cover option precedence and both CLI spellings, collection-to-cell wiring, unit boundaries, missing values, percentages, I/O behavior, and sorting.
This commit is contained in:
Peder Bergan
2026-09-15 20:47:06 -04:00
committed by GitHub
parent 25b6b36299
commit c10a2adbd4
11 changed files with 169 additions and 6 deletions
@@ -25,6 +25,12 @@ see information on these options by running `btm -h`, or run `btm --help` to dis
| | for table widgets. |
| `-d`, `--time_delta <TIME>` | The amount of time changed upon zooming. |
## Disk Options
| Option | Behaviour |
| -------------------------- | --------------------------------------------------------------- |
| `--disk_use_binary_prefix` | Displays used, free, and total disk space with binary prefixes. |
## Process Options
| Option | Behaviour |
@@ -30,6 +30,16 @@ You can also set the sort order by changing `disk.sort_order` with `"Ascending"`
sort_order = "Ascending"
```
## Disk Space Units
Disk space uses decimal prefixes (KB, MB, GB, TB) by default. To display the Used, Free, and Total columns
with binary prefixes (KiB, MiB, GiB, TiB), enable `use_binary_prefix`:
```toml
[disk]
use_binary_prefix = true
```
## Show Unmounted Devices (Linux only)
By default, only mounted devices are shown. To also show unmounted devices on Linux, enable `include_unmounted`: