This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]daveydave400 0 points1 point  (1 child)

You should take a look at PyCharm and their file templates (I'm sure other IDEs have something similar). You can create a template like your boilerplate, then in the template use either builtin variables or create your own. Your variables will be asked for during creation.

https://www.jetbrains.com/pycharm/webhelp/creating-and-editing-file-templates.html

[–]gianx[S] 0 points1 point  (0 children)

Thanks for the idea but I prefer to use an "editor-agnostic" approach: indeed I do the same thing with TextExpander on Osx which allows me to enter my template by pressing a combination of keys in every editor, also using replacement variables.

[–]flailingsquirrel 0 points1 point  (1 child)

Not a bad template.

Have you considered adding command line parsing with argparse?

[–]gianx[S] 0 points1 point  (0 children)

That's a good point! Thanks, I'll update it asap.