V4 vs V3 - go-easygen/easygen GitHub Wiki

As planned in issues#23:

I'm planning the following up-coming changes

  • will support .json data as well as the .yaml data
  • most importantly, I'm planning to make none-backward-compatible breaking changes to the easygen command line option. The reason is that, the more I use easygen, the more cases that I find that I'm using the same template with different driving data. I.e., previously in my mind, the driving data is the most important, but now I realize that the template is more important.

So, I'll be changing the easygen command line option as follows:

easygen [options] template_name [data_filename [data_filename...]]

So,

  • If only template_name is given, then the data_filename will be derived from the template_name. I.e., reverse the current behavior. So for the existing usage of easygen filename, when filename does not specify the extension. It'll still work, without any changes.
  • for the current usage of easygen -tf name YamlFileName (or easygen -tf name f1 f2 etc), the new usage will be easygen name YamlFileName. I.e., there won't be the -tf option any more.

Note in the above plan, "the current usage" refers to the V3 behavior, while "the new usage" refers to the planned V4 behavior.

Basically, the change

  • is only at external command line option level, except for
  • func Process, which was using the V3's calling convention and only works properly in V4+ in the case that there is only one fileName passed to it. If need to pass more files, use Process2() instead. Check out the Process Example in which Process2() is used right after Process() to give the same result.
  • other than that, Process2() can read .json data under the hood now.