Parses program arguments.

Returns instance of ProgramArgs, which allows working on parsed data.

On top of parsing arguments, this function catches InvalidArgumentsException, handles --version and --help flags as well as help subcommand. Exception is handled by printing out the error message along with program usage information and exiting.

Version and help is handled by prining out information and exiting.

If you want to only parse argument without additional handling, see parseArgs.

Similarly to parseArgs, args array is taken by reference, after call it points to first not-parsed argument (after --).

See Also