cmd: added support for flagsets in commands

Now each command can declare its own flagset. Time to port all commands
now :-)

Related to #351.