1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/hash.md
2021-04-18 11:46:42 -07:00

1.1 KiB

Home

jc.parsers.hash

jc - JSON CLI output utility hash command output parser

Usage (cli):

$ hash | jc --hash

Usage (module):

import jc.parsers.hash
result = jc.parsers.hash.parse(hash_command_output)

Schema:

[
  {
    "command":       string,
    "hits":          integer
  }
]

Examples:

$ hash | jc --hash -p
[
  {
    "hits": 2,
    "command": "/bin/cat"
  },
  {
    "hits": 1,
    "command": "/bin/ls"
  }
]

info

info()

Provides parser metadata (version, author, etc.)

parse

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:

List of Dictionaries. Raw or processed structured data.

Parser Information

Compatibility: linux, darwin, cygwin, aix, freebsd

Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)