jc icon indicating copy to clipboard operation
jc copied to clipboard

Values in "free -w" don't get converted to integers

Open papparapa opened this issue 2 years ago • 1 comments

The "free -w" command splits the "buff/cache" column into a "buffers" column and a "cache" column.

It is necessary to convert the values in the "buffers" and "cache" columns to integers, but currently they are simply output as strings.

That is, I expect something like the following:

$ jc free -w | jq .
[
  {
    "type": "Mem",
    "total": 8053804,
    "used": 1305880,
    "free": 5557980,
    "shared": 60580,
    "buffers": 76340,
    "cache": 1113604,
    "available": 6430688
  },
  {
    "type": "Swap",
    "total": 2097152,
    "used": 0,
    "free": 2097152
  }
]

But now the result is

$ jc free -w | jq .
[
  {
    "type": "Mem",
    "total": 8053804,
    "used": 1305880,
    "free": 5557980,
    "shared": 60580,
    "buffers": "76340",
    "cache": "1113604",
    "available": 6430688
  },
  {
    "type": "Swap",
    "total": 2097152,
    "used": 0,
    "free": 2097152
  }
]

papparapa avatar Sep 20 '22 13:09 papparapa

Merging into dev to be available in the next jc release in a few weeks. Thanks!

kellyjonbrazil avatar Sep 21 '22 00:09 kellyjonbrazil

merged into v1.22.0

kellyjonbrazil avatar Sep 27 '22 19:09 kellyjonbrazil