Changes the way commands and options are parsed
Reorders parsing of commands and options.
Options are now parsed on a per command basis. This way commands
can have different options and arguments.
This makes it possible to directly specify the project and location of
a log entry.
Also fixes some memory leaks in copyTemplate, hasContent and getNextID.