From 649c0aa7c157f87691cc8eeac64c747e81f63594 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 23 Oct 2019 14:10:10 -0700 Subject: [PATCH] add documentation --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ jc/parsers/jobs.py | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) 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 &" + } +] """