Closed aidan-gallagher closed 4 years ago
My first thought is, why use cog if you only want the generated output? That sounds like a Python program with print statements. Can you say more about why it would be useful?
Thanks for the quick reply Ned.
Reasons I want to have the cog source in 1 repo which will be shared across projects. Each project will generate a different file based off of a config file which will be stored in each projects repo.
I don't want the generated code in the shared repo because it is different per project. I don't want the cog source in the project repo because then it is duplicated & other smaller reasons.
What Cog gives me
With Cog I can write a template .cpp/.h file.
It is clear what remains constant and what changes. <--- The main reason
I get some wee bonuses like Output line suffixes if I want.
Without Cog I could replace each cog.outl call with a print or write to file command. I would also have to call print/write for all the constant bits of code.
After writing this I'm beginging to wonder if Cog isn't the right tool for me.
I think i'm going to use jinja instead.
Is it possible to write the generator code without the cog python source code embedded in it.
I don't think it would be too hard to parse the output myself and remove all cog statements however I'd prefer to use the libraries functionality if I can.