Use a POSIX compatible flag parser.

So we can use flags before and after arguments, and we can group boolean flags, just like git does.