mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-21 00:19:42 +02:00
update docs
This commit is contained in:
@ -5,48 +5,50 @@ Usage:
|
||||
|
||||
Examples:
|
||||
|
||||
$ history | jc --history -p
|
||||
[
|
||||
{
|
||||
"line": "118",
|
||||
"command": "sleep 100"
|
||||
},
|
||||
{
|
||||
"line": "119",
|
||||
"command": "ls /bin"
|
||||
},
|
||||
{
|
||||
"line": "120",
|
||||
"command": "echo \"hello\""
|
||||
},
|
||||
{
|
||||
"line": "121",
|
||||
"command": "docker images"
|
||||
},
|
||||
...
|
||||
]
|
||||
$ history | jc --history -p
|
||||
[
|
||||
{
|
||||
"line": "118",
|
||||
"command": "sleep 100"
|
||||
},
|
||||
{
|
||||
"line": "119",
|
||||
"command": "ls /bin"
|
||||
},
|
||||
{
|
||||
"line": "120",
|
||||
"command": "echo \"hello\""
|
||||
},
|
||||
{
|
||||
"line": "121",
|
||||
"command": "docker images"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ history | jc --history -p -r
|
||||
{
|
||||
"118": "sleep 100",
|
||||
"119": "ls /bin",
|
||||
"120": "echo \"hello\"",
|
||||
"121": "docker images",
|
||||
...
|
||||
}
|
||||
$ history | jc --history -p -r
|
||||
{
|
||||
"118": "sleep 100",
|
||||
"119": "ls /bin",
|
||||
"120": "echo \"hello\"",
|
||||
"121": "docker images",
|
||||
...
|
||||
}
|
||||
"""
|
||||
import jc
|
||||
|
||||
|
||||
def process(proc_data):
|
||||
'''schema:
|
||||
[
|
||||
{
|
||||
"line": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
'''
|
||||
"""
|
||||
schema:
|
||||
|
||||
[
|
||||
{
|
||||
"line": string,
|
||||
"command": string
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
# rebuild output for added semantic information
|
||||
processed = []
|
||||
@ -60,6 +62,15 @@ def process(proc_data):
|
||||
|
||||
|
||||
def parse(data, raw=False, quiet=False):
|
||||
"""
|
||||
Main parsing function
|
||||
|
||||
Arguments:
|
||||
|
||||
raw: (boolean) output preprocessed JSON if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
"""
|
||||
|
||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||
compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd']
|
||||
|
||||
|
Reference in New Issue
Block a user