diff --git a/jc/parsers/foo.py b/jc/parsers/foo.py new file mode 100644 index 00000000..0bad5c84 --- /dev/null +++ b/jc/parsers/foo.py @@ -0,0 +1,52 @@ +"""jc - JSON CLI output utility foo Parser + +Usage: + specify --foo as the first argument if the piped input is coming from foo + +Examples: + +$ foo | jc --foo -p +[] + +$ foo | jc --foo -p -r +[] +""" +import jc.utils + + +def process(proc_data): + '''schema: + [ + { + "foo": string, + "bar": boolean, + "baz": integer + } + ] + ''' + + # rebuild output for added semantic information + return proc_data + + +def parse(data, raw=False, quiet=False): + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + + if not quiet: + jc.utils.compatibility(__name__, compatible) + + raw_output = [] + cleandata = data.splitlines() + + # Clear any blank lines + cleandata = list(filter(None, cleandata)) + + if cleandata: + # parse the content + pass + + if raw: + return raw_output + else: + return process(raw_output)