title: Best practice to create a config file for an existing software programmatically
body: <p>I am working on a tool that can help me generate a configuration file for use with an existing software (Vagrant), of course, in the format which Vagrant understands. 
  However, I am having a tough time planning my program design that can help me with dynamic generation of the configuration file with a programmatic approach. Moreover, the config file structure will consist of many optional snippets as well which may/not be required in the final configuration file as per the requirements of the user. I can't think of some efficient approach to go about it.</p>
  
  <p>Three approaches which I have thought of are : </p>
  
  <p>1) Working on a readymade template and just replacing the placeholders with appropriate text. 
  2) Creating the config file on the fly with String append etc. (Doesn't look like a robust and future proof solution to me). 
  3) Bifurcation of the basic config structure into sub parts and then including each required component one by one as and when required, then replacing the placeholder values. </p>
  
  <p>I am not very confident if any of these is the best professional approach to dynamically generate such a file.</p>