diff options
| author | Patrick Williams <patrick@stwcx.xyz> | 2016-10-09 16:19:52 -0500 |
|---|---|---|
| committer | Patrick Williams <patrick@stwcx.xyz> | 2016-10-13 08:07:57 -0500 |
| commit | a90b01e255a42b2de779d182635ec24e61214f6f (patch) | |
| tree | 885f4e86c3c9b5c5d0e185f2b208593a70a45d06 /tools | |
| parent | 71273297d568f9a61a092bb412b7e628bf347a0f (diff) | |
| download | sdbusplus-a90b01e255a42b2de779d182635ec24e61214f6f.tar.gz sdbusplus-a90b01e255a42b2de779d182635ec24e61214f6f.zip | |
sdbus++: Utility for rendering interface YAML
Change-Id: I0ceeaba9280ef9a05c03edb2a72a15ba8591b0be
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/sdbus++ | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/sdbus++ b/tools/sdbus++ new file mode 100755 index 0000000..a3ed715 --- /dev/null +++ b/tools/sdbus++ @@ -0,0 +1,34 @@ +#!/bin/env python +import sdbusplus +import mako.lookup +import argparse + +def main(): + valid_types = { 'interface': sdbusplus.Interface } + valid_processes = { 'markdown' : "markdown" } + + parser = argparse.ArgumentParser(description='Process sdbus++ YAML files.') + + parser.add_argument('-r', '--rootdir', dest='rootdir', default='example', + type=str, help='Location of files to process.') + parser.add_argument('-t', '--templatedir', dest='templatedir', + default='templates', type=str, + help='Location of templates files.') + parser.add_argument('typeName', metavar='TYPE', type=str, + choices=valid_types.keys(), help='Type to operate on.') + parser.add_argument('process', metavar='PROCESS', type=str, + choices=valid_processes.keys(), + help='Process to apply.') + parser.add_argument('item', metavar='ITEM', type=str, + help='Item to process.') + + args = parser.parse_args(); + + lookup = mako.lookup.TemplateLookup(directories=[args.templatedir]) + + instance = valid_types[args.typeName].load(args.item, args.rootdir) + function = getattr(instance, args.process) + print(function(lookup)) + +if __name__ == '__main__': + main() |

