mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
change 'Use%' to 'Use_percent'
This commit is contained in:
@ -92,7 +92,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "977500",
|
"1K-blocks": "977500",
|
||||||
"Used": "0",
|
"Used": "0",
|
||||||
"Available": "977500",
|
"Available": "977500",
|
||||||
"Use%": "0%",
|
"Use_percent": "0%",
|
||||||
"Mounted": "/dev"
|
"Mounted": "/dev"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "201732",
|
"1K-blocks": "201732",
|
||||||
"Used": "1180",
|
"Used": "1180",
|
||||||
"Available": "200552",
|
"Available": "200552",
|
||||||
"Use%": "1%",
|
"Use_percent": "1%",
|
||||||
"Mounted": "/run"
|
"Mounted": "/run"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "20508240",
|
"1K-blocks": "20508240",
|
||||||
"Used": "5747284",
|
"Used": "5747284",
|
||||||
"Available": "13696152",
|
"Available": "13696152",
|
||||||
"Use%": "30%",
|
"Use_percent": "30%",
|
||||||
"Mounted": "/"
|
"Mounted": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "1008648",
|
"1K-blocks": "1008648",
|
||||||
"Used": "0",
|
"Used": "0",
|
||||||
"Available": "1008648",
|
"Available": "1008648",
|
||||||
"Use%": "0%",
|
"Use_percent": "0%",
|
||||||
"Mounted": "/dev/shm"
|
"Mounted": "/dev/shm"
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
|
@ -5,7 +5,7 @@ jc changelog
|
|||||||
- Add uptime parser
|
- Add uptime parser
|
||||||
- Add history parser
|
- Add history parser
|
||||||
- Flatten env parser output
|
- Flatten env parser output
|
||||||
- Remove problematic characters from key names in: free, history, lsblk, lsof, and w
|
- Remove problematic characters from key names in: df, free, history, lsblk, lsof, and w
|
||||||
|
|
||||||
20191023 v0.9.1
|
20191023 v0.9.1
|
||||||
- Add jobs parser
|
- Add jobs parser
|
||||||
|
@ -12,7 +12,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "977500",
|
"1K-blocks": "977500",
|
||||||
"Used": "0",
|
"Used": "0",
|
||||||
"Available": "977500",
|
"Available": "977500",
|
||||||
"Use%": "0%",
|
"Use_percent": "0%",
|
||||||
"Mounted": "/dev"
|
"Mounted": "/dev"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "201732",
|
"1K-blocks": "201732",
|
||||||
"Used": "1180",
|
"Used": "1180",
|
||||||
"Available": "200552",
|
"Available": "200552",
|
||||||
"Use%": "1%",
|
"Use_percent": "1%",
|
||||||
"Mounted": "/run"
|
"Mounted": "/run"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -28,7 +28,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "20508240",
|
"1K-blocks": "20508240",
|
||||||
"Used": "5747284",
|
"Used": "5747284",
|
||||||
"Available": "13696152",
|
"Available": "13696152",
|
||||||
"Use%": "30%",
|
"Use_percent": "30%",
|
||||||
"Mounted": "/"
|
"Mounted": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ $ df | jc --df -p
|
|||||||
"1K-blocks": "1008648",
|
"1K-blocks": "1008648",
|
||||||
"Used": "0",
|
"Used": "0",
|
||||||
"Available": "1008648",
|
"Available": "1008648",
|
||||||
"Use%": "0%",
|
"Use_percent": "0%",
|
||||||
"Mounted": "/dev/shm"
|
"Mounted": "/dev/shm"
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
@ -51,5 +51,10 @@ def parse(data):
|
|||||||
|
|
||||||
cleandata = data.splitlines()
|
cleandata = data.splitlines()
|
||||||
headers = [h for h in ' '.join(cleandata[0].strip().split()).split() if h]
|
headers = [h for h in ' '.join(cleandata[0].strip().split()).split() if h]
|
||||||
|
|
||||||
|
# clean up 'Use%' header
|
||||||
|
# even though % in a key is valid json, it can make things difficult
|
||||||
|
headers = ['Use_percent' if x == 'Use%' else x for x in headers]
|
||||||
|
|
||||||
raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), cleandata[1:])
|
raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), cleandata[1:])
|
||||||
return [dict(zip(headers, r)) for r in raw_data]
|
return [dict(zip(headers, r)) for r in raw_data]
|
||||||
|
Reference in New Issue
Block a user