1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-23 00:29:59 +02:00

update documentation

This commit is contained in:
Kelly Brazil
2021-04-08 12:42:01 -07:00
parent a4b6846f63
commit e28c08b136
46 changed files with 976 additions and 1209 deletions

View File

@ -13,6 +13,35 @@ Usage (module):
import jc.parsers.id
result = jc.parsers.id.parse(id_command_output)
Schema:
{
"uid": {
"id": integer,
"name": string
},
"gid": {
"id": integer,
"name": string
},
"groups": [
{
"id": integer,
"name": string
},
{
"id": integer,
"name": string
}
],
"context": {
"user": string,
"role": string,
"type": string,
"level": string
}
}
Compatibility:
'linux', 'darwin', 'aix', 'freebsd'
@ -79,7 +108,8 @@ import jc.utils
class info():
version = '1.1'
"""Provides parser metadata (version, author, etc.)"""
version = '1.2'
description = '`id` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@ -93,7 +123,7 @@ class info():
__version__ = info.version
def process(proc_data):
def _process(proc_data):
"""
Final processing to conform to the schema.
@ -103,34 +133,7 @@ def process(proc_data):
Returns:
Dictionary. Structured data with the following schema:
{
"uid": {
"id": integer,
"name": string
},
"gid": {
"id": integer,
"name": string
},
"groups": [
{
"id": integer,
"name": string
},
{
"id": integer,
"name": string
}
],
"context": {
"user": string,
"role": string,
"type": string,
"level": string
}
}
Dictionary. Structured data to conform to the schema.
"""
if 'uid' in proc_data:
if 'id' in proc_data['uid']:
@ -221,4 +224,4 @@ def parse(data, raw=False, quiet=False):
if raw:
return raw_output
else:
return process(raw_output)
return _process(raw_output)