Move code out of plugins' header files

This is a must if we ever want people use the plugins as standalone libraries.
Let boilerplate_generator write out the file(s) directly

Instead of writing everything to stdout, the boilerplate_generator should write
to a file in a given directory. This way it can write out multiple files from a
single input in the future.

Also make args processing and validation a bit nicer.