mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
formatting
This commit is contained in:
53
README.md
53
README.md
@ -30,6 +30,7 @@ The first argument is required and identifies the command that is piping output
|
|||||||
- `--ls` enables the `ls` parser
|
- `--ls` enables the `ls` parser
|
||||||
- `--ifconfig` enables the `ifconfig` parser
|
- `--ifconfig` enables the `ifconfig` parser
|
||||||
- `--netstat` enables the `netstat` parser
|
- `--netstat` enables the `netstat` parser
|
||||||
|
- `--ps` enables the `ps` parser
|
||||||
|
|
||||||
The second `-p` argument is optional and specifies whether to pretty format the JSON output.
|
The second `-p` argument is optional and specifies whether to pretty format the JSON output.
|
||||||
|
|
||||||
@ -279,5 +280,57 @@ $ netstat -lp | jc --netstat -p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
### ps
|
||||||
|
```
|
||||||
|
$ ps -ef | jc --ps -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "1",
|
||||||
|
"PPID": "0",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:05",
|
||||||
|
"CMD": "/lib/systemd/systemd --system --deserialize 35"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "2",
|
||||||
|
"PPID": "0",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:00",
|
||||||
|
"CMD": "[kthreadd]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "4",
|
||||||
|
"PPID": "2",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:00",
|
||||||
|
"CMD": "[kworker/0:0H]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "6",
|
||||||
|
"PPID": "2",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:00",
|
||||||
|
"CMD": "[mm_percpu_wq]"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
Feel free to add/improve code or parsers!
|
||||||
|
|
||||||
## Acknowledgments
|
## Acknowledgments
|
||||||
- `ifconfig-parser` module from https://github.com/KnightWhoSayNi/ifconfig-parser
|
- `ifconfig-parser` module from https://github.com/KnightWhoSayNi/ifconfig-parser
|
||||||
|
- Parsing code from Conor Heine at https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501
|
||||||
|
@ -2,7 +2,7 @@ jc changelog
|
|||||||
|
|
||||||
2019xxxx v0.5.0
|
2019xxxx v0.5.0
|
||||||
- Fix netstat -p parsing for Ubuntu
|
- Fix netstat -p parsing for Ubuntu
|
||||||
+ Add ps parser
|
- Add ps parser
|
||||||
+ Add route parser
|
+ Add route parser
|
||||||
+ Change some ifconfig fields to integers
|
+ Change some ifconfig fields to integers
|
||||||
+ Use maxsplit option in split in ls.py line 109... otherwise filenames with multiple spaces
|
+ Use maxsplit option in split in ls.py line 109... otherwise filenames with multiple spaces
|
||||||
|
@ -7,8 +7,52 @@ Usage:
|
|||||||
- ef
|
- ef
|
||||||
- axu
|
- axu
|
||||||
|
|
||||||
Examples:
|
Example:
|
||||||
|
|
||||||
|
$ ps -ef | jc --ps -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "1",
|
||||||
|
"PPID": "0",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:05",
|
||||||
|
"CMD": "/lib/systemd/systemd --system --deserialize 35"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "2",
|
||||||
|
"PPID": "0",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:00",
|
||||||
|
"CMD": "[kthreadd]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "4",
|
||||||
|
"PPID": "2",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:00",
|
||||||
|
"CMD": "[kworker/0:0H]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"UID": "root",
|
||||||
|
"PID": "6",
|
||||||
|
"PPID": "2",
|
||||||
|
"C": "0",
|
||||||
|
"STIME": "13:58",
|
||||||
|
"TTY": "?",
|
||||||
|
"TIME": "00:00:00",
|
||||||
|
"CMD": "[mm_percpu_wq]"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user