diff --git a/README.md b/README.md index f5cd1281..df9a2fd4 100755 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ jc [parser] [options] - `--free` enables the `free` parser - `--ifconfig` enables the `ifconfig` parser - `--iptables` enables the `iptables` parser +- `--jobs` enables the `jobs` parser - `--ls` enables the `ls` parser - `--lsblk` enables the `lsblk` parser - `--mount` enables the `mount` parser @@ -549,6 +550,44 @@ $ sudo iptables -vnL -t filter | jc --iptables -p ... ] ``` +### jobs +``` +$ jobs -l | jc --jobs -p +[ + { + "job_number": 1, + "pid": 14798, + "status": "Running", + "command": "sleep 10000 &" + }, + { + "job_number": 2, + "pid": 14799, + "status": "Running", + "command": "sleep 10001 &" + }, + { + "job_number": 3, + "pid": 14800, + "status": "Running", + "command": "sleep 10002 &" + }, + { + "job_number": 4, + "pid": 14814, + "history": "previous", + "status": "Running", + "command": "sleep 10003 &" + }, + { + "job_number": 5, + "pid": 14815, + "history": "current", + "status": "Running", + "command": "sleep 10004 &" + } +] +``` ### ls ``` $ ls -l /bin | jc --ls -p diff --git a/jc/parsers/jobs.py b/jc/parsers/jobs.py index 70d7606f..2ebac438 100644 --- a/jc/parsers/jobs.py +++ b/jc/parsers/jobs.py @@ -3,9 +3,45 @@ Usage: specify --jobs as the first argument if the piped input is coming from jobs + Also supports the -l option + Examples: - +$ jobs -l | jc --jobs -p +[ + { + "job_number": 1, + "pid": 14798, + "status": "Running", + "command": "sleep 10000 &" + }, + { + "job_number": 2, + "pid": 14799, + "status": "Running", + "command": "sleep 10001 &" + }, + { + "job_number": 3, + "pid": 14800, + "status": "Running", + "command": "sleep 10002 &" + }, + { + "job_number": 4, + "pid": 14814, + "history": "previous", + "status": "Running", + "command": "sleep 10003 &" + }, + { + "job_number": 5, + "pid": 14815, + "history": "current", + "status": "Running", + "command": "sleep 10004 &" + } +] """