diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-10-03 13:35:14 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-03 18:03:09 +0200 |
commit | 4a44d7bbc68ff3e363e6c166a588474cbd6c20f8 (patch) | |
tree | 05527f5ad13ba290127c5db1e516a3298b7dda1c /guix | |
parent | 882383a9aa5fbeef6f29d359a786a6db7c9e03db (diff) |
ui: Recognize the same size units as Coreutils.
* guix/ui.scm (size->number): Add a bunch of large units. Recognize
one-letter unit names. Change "KB" to "kB".
* tests/ui.scm ("size->number, 1T"): New test.
* doc/guix.texi (Invoking guix gc): Add cross-reference to "Block size"
in the Coreutils manual.
(Invoking guix system): Likewise.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/ui.scm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 531d922ad9..04345d4770 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -189,14 +189,22 @@ interpreted." ((compose inexact->exact round) (* num (match unit - ("KiB" (expt 2 10)) - ("MiB" (expt 2 20)) - ("GiB" (expt 2 30)) - ("TiB" (expt 2 40)) - ("KB" (expt 10 3)) + ((or "KiB" "K" "k") (expt 2 10)) + ((or "MiB" "M") (expt 2 20)) + ((or "GiB" "G") (expt 2 30)) + ((or "TiB" "T") (expt 2 40)) + ((or "PiB" "P") (expt 2 50)) + ((or "EiB" "E") (expt 2 60)) + ((or "ZiB" "Z") (expt 2 70)) + ((or "YiB" "Y") (expt 2 80)) + ("kB" (expt 10 3)) ("MB" (expt 10 6)) ("GB" (expt 10 9)) ("TB" (expt 10 12)) + ("PB" (expt 10 15)) + ("EB" (expt 10 18)) + ("ZB" (expt 10 21)) + ("YB" (expt 10 24)) ("" 1) (_ (leave (_ "unknown unit: ~a~%") unit))))))) |