This patch improves cl to support sub commands. For example, "git checkout", "git status", etc where each subcommand has an unrelated set of options.
An example of how to use this new functionality is included in this patch where the llvm-pdbdump tool is updated to use this new functionality. If / when this patch is accepted, I will only submit with the changes to cl, and then submit the changes to llvm-pdbdump as a followup. It's only included here as an example.
Any code which was previously written against cl will continue to work unmodified. If you don't specify a subcommand for an option, commands go into the "top level" subcommand, which is searched when no subcommand is specified.
There is another special subcommand called AllSubcommands which, when specified, will inject an option into every sub command. This is useful, for example, to make foo.exe --help and foo.exe command --help both work and do the right thing.
options can also have multiple subcommands, so that the same option will appear in multiple subcommands.
Help output is updated as well to print info about supported subcommands, and also to print the list of options for individual subcommands.
Not sure who to include as a reviewer, feel free to add others as appropriate.
You can write = nullptr here.