dmulyalin / ttp

Template Text Parser
MIT License
351 stars 34 forks source link

yaml output starts off as a list instead of dict #120

Open bassman-junk opened 9 months ago

bassman-junk commented 9 months ago

Is there a way to remove the '-' or list from the parent dict structure of the yaml output?

ex:

I would like for it to be as so: r_cfg: interfaces: intf: Loopback0 ip: !!python/object/apply:ipaddress.IPv4Interface

bassman-junk commented 9 months ago

Sorry, the format came out wrong. Here is a screenshot. Screenshot 2024-02-08 at 8 50 55 AM

dmulyalin commented 9 months ago

yeah, have a look at these: https://ttp.readthedocs.io/en/latest/Forming%20Results%20Structure/index.html#results-structure https://ttp.readthedocs.io/en/latest/Template%20Tag/Template%20Tag.html#results

Need to use <template name="r_cfg" results="per_template"> ...template goes here... </template> plus when calling ttp parser object result need to add structure keyword e.g. parser.result(structure="dictionary"), that combined should give you all dictionary output with no top list.