mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
3e576250b1bfe1c62c556f2fa0425103b0ede1f9
JC
JSON CLI output utility v0.1
jc
is used to JSONify the output of many standard linux cli tools for easier parsing in scripts. Parsers for ls
, ifconfig
, and netstat
are currently included and more can be added via modules.
Usage
jc
accepts piped input from STDIN
and outputs a JSON representation of the previous command to STDOUT
. The JSON output can be compact or pretty formatted.
The first argument is required and identifies the command that is piping output to jc
input. For example:
--ls
enables thels
parser--ifconfig
enables theifconfig
parser--netstat
enables thenetstat
parser
The second -p
argument is optional and specifies whether to pretty format the JSON output.
Examples
$ ls -l /bin | jc --ls -p
[
{
"filename": "bash",
"flags": "-r-xr-xr-x",
"links": 1,
"owner": "root",
"group": "wheel",
"bytes": 618416,
"date": "May 3 22:26"
},
{
"filename": "cat",
"flags": "-rwxr-xr-x",
"links": 1,
"owner": "root",
"group": "wheel",
"bytes": 23648,
"date": "May 3 22:26"
},
{
"filename": "chmod",
"flags": "-rwxr-xr-x",
"links": 1,
"owner": "root",
"group": "wheel",
"bytes": 30016,
"date": "May 3 22:26"
},
...
]
Description
CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
bashbash-scriptingclicommand-linecommand-line-interfacecommand-line-toolconvertjsonlinuxparserspythonpython-libraryscriptingserializeshell-scriptingyaml
Readme
27 MiB
Languages
Python
99%
Shell
1%