free: Show single line statistics

Added the -L --line option to free to show a small
set of memory statistics on a single line of 80 characters.
Largely based on the work of @Ulenrich1 and updated to
the new API.

References:
 procps-ng/procps#156

Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
Craig Small
2023-05-02 20:32:38 +10:00
parent 4a315c9230
commit b31ac2dcce
4 changed files with 34 additions and 2 deletions

View File

@@ -55,3 +55,7 @@ set test "free with positive repeat count"
spawn $free -c 2
expect_continue "$test" "^${free_header}"
expect_pass "$test" "${free_header}"
set test "free with single line"
spawn $free -L
expect_pass "$test" "^SwapUse\\s+\\d+\\s+CachUse\\s+\\d+\\s+MemUse\\s+\\d+\\s+MemFree\\s+\\d+\\s*$"