1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00
Files
jc/docs/parsers/top.md
2022-05-10 16:08:56 -07:00

1.0 KiB

Home

jc.parsers.top

jc - JSON Convert top -b command output parser

<>

Usage (cli):

$ top -b -n 3 | jc --top

or

$ jc top -b -n 3

Usage (module):

import jc
result = jc.parse('top', top_command_output)

Schema:

[
  {
    "top":     string,
    "bar":     boolean,
    "baz":     integer
  }
]

Examples:

$ top | jc --top -p
[]

$ top | jc --top -p -r
[]

parse

def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]

Main text parsing function

Parameters:

data:        (string)  text data to parse
raw:         (boolean) unprocessed output if True
quiet:       (boolean) suppress warning messages if True

Returns:

List of Dictionaries. Raw or processed structured data.

Parser Information

Compatibility: linux

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