From efbf3549606fc77f8c16587ff04a0c316dfe5c00 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Tue, 17 Dec 2019 09:24:08 -0800 Subject: [PATCH] doc update for pip show --- README.md | 31 +++++++++++++ docgen.sh | 1 + docs/parsers/pip_show.md | 94 ++++++++++++++++++++++++++++++++++++++++ jc/parsers/pip_show.py | 12 ----- 4 files changed, 126 insertions(+), 12 deletions(-) create mode 100644 docs/parsers/pip_show.md diff --git a/README.md b/README.md index 6cd94acf..3e47c7f1 100755 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ jc PARSER [OPTIONS] - `--mount` enables the `mount` parser - `--netstat` enables the `netstat` parser - `--pip-list` enables the `pip list` parser +- `--pip-show` enables the `pip show` parser - `--ps` enables the `ps` parser - `--route` enables the `route` parser - `--ss` enables the `ss` parser @@ -1121,6 +1122,36 @@ $ pip list | jc --pip-list -p ... ] +``` +### pip show +``` +$ pip show wrapt wheel | jc --pip-show -p +[ + { + "name": "wrapt", + "version": "1.11.2", + "summary": "Module for decorators, wrappers and monkey patching.", + "home_page": "https://github.com/GrahamDumpleton/wrapt", + "author": "Graham Dumpleton", + "author_email": "Graham.Dumpleton@gmail.com", + "license": "BSD", + "location": "/usr/local/lib/python3.7/site-packages", + "requires": null, + "required_by": "astroid" + }, + { + "name": "wheel", + "version": "0.33.4", + "summary": "A built-package format for Python.", + "home_page": "https://github.com/pypa/wheel", + "author": "Daniel Holth", + "author_email": "dholth@fastmail.fm", + "license": "MIT", + "location": "/usr/local/lib/python3.7/site-packages", + "requires": null, + "required_by": null + } +] ``` ### ps ``` diff --git a/docgen.sh b/docgen.sh index 7337bada..f51267d4 100755 --- a/docgen.sh +++ b/docgen.sh @@ -24,6 +24,7 @@ pydocmd simple jc.parsers.lsof+ > ../docs/parsers/lsof.md pydocmd simple jc.parsers.mount+ > ../docs/parsers/mount.md pydocmd simple jc.parsers.netstat+ > ../docs/parsers/netstat.md pydocmd simple jc.parsers.pip_list+ > ../docs/parsers/pip_list.md +pydocmd simple jc.parsers.pip_show+ > ../docs/parsers/pip_show.md pydocmd simple jc.parsers.ps+ > ../docs/parsers/ps.md pydocmd simple jc.parsers.route+ > ../docs/parsers/route.md pydocmd simple jc.parsers.ss+ > ../docs/parsers/ss.md diff --git a/docs/parsers/pip_show.md b/docs/parsers/pip_show.md new file mode 100644 index 00000000..63617542 --- /dev/null +++ b/docs/parsers/pip_show.md @@ -0,0 +1,94 @@ +# jc.parsers.pip_show +jc - JSON CLI output utility pip-show Parser + +Usage: + + specify --pip-show as the first argument if the piped input is coming from pip show + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ pip show wrapt jc wheel | jc --pip-show -p + [ + { + "name": "wrapt", + "version": "1.11.2", + "summary": "Module for decorators, wrappers and monkey patching.", + "home_page": "https://github.com/GrahamDumpleton/wrapt", + "author": "Graham Dumpleton", + "author_email": "Graham.Dumpleton@gmail.com", + "license": "BSD", + "location": "/usr/local/lib/python3.7/site-packages", + "requires": null, + "required_by": "astroid" + }, + { + "name": "wheel", + "version": "0.33.4", + "summary": "A built-package format for Python.", + "home_page": "https://github.com/pypa/wheel", + "author": "Daniel Holth", + "author_email": "dholth@fastmail.fm", + "license": "MIT", + "location": "/usr/local/lib/python3.7/site-packages", + "requires": null, + "required_by": null + } + ] + +## info +```python +info(self, /, *args, **kwargs) +``` + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + dictionary structured data with the following schema: + + [ + { + "name": string, + "version": string, + "summary": string, + "home_page": string, + "author": string, + "author_email": string, + "license": string, + "location": string, + "requires": string, + "required_by": string + } + ] + + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + dictionary raw or processed structured data + diff --git a/jc/parsers/pip_show.py b/jc/parsers/pip_show.py index 8fd315ce..36cf2c77 100644 --- a/jc/parsers/pip_show.py +++ b/jc/parsers/pip_show.py @@ -24,18 +24,6 @@ Examples: "requires": null, "required_by": "astroid" }, - { - "name": "jc", - "version": "1.1.1", - "summary": "This tool serializes the output of popular command line tools to structured JSON output.", - "home_page": "https://github.com/kellyjonbrazil/jc", - "author": "Kelly Brazil", - "author_email": "kellyjonbrazil@gmail.com", - "license": "MIT", - "location": "/Users/kbrazil/git/jc", - "requires": "ifconfig-parser", - "required_by": null - }, { "name": "wheel", "version": "0.33.4",