mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
change buff/cache key to buff_cache
This commit is contained in:
@ -147,7 +147,7 @@ $ free | jc --free -p
|
||||
"used": "213104",
|
||||
"free": "1148452",
|
||||
"shared": "1176",
|
||||
"buff/cache": "655744",
|
||||
"buff_cache": "655744",
|
||||
"available": "1622204"
|
||||
},
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ $ free | jc --free -p
|
||||
"used": "213104",
|
||||
"free": "1148452",
|
||||
"shared": "1176",
|
||||
"buff/cache": "655744",
|
||||
"buff_cache": "655744",
|
||||
"available": "1622204"
|
||||
},
|
||||
{
|
||||
@ -33,9 +33,12 @@ def parse(data):
|
||||
|
||||
cleandata = data.splitlines()
|
||||
headers = [h for h in ' '.join(cleandata[0].strip().split()).split() if h]
|
||||
|
||||
headers.insert(0, "type")
|
||||
|
||||
# clean up 'buff/cache' header
|
||||
# even though forward slash in a key is valid json, it can make things difficult
|
||||
headers = ['buff_cache' if x == 'buff/cache' else x for x in headers]
|
||||
|
||||
raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), cleandata[1:])
|
||||
output = [dict(zip(headers, r)) for r in raw_data]
|
||||
|
||||
|
Reference in New Issue
Block a user