-
Andrew Sun authored
Summary: NestedCommandLineApp works by performing two passes over the argument vector: 1. Treat the entire argv as a single command, ignoring subcommands. Consume all options that "match" a global flag here. 2. Find the first positional argument in argv and treat it as a subcommand, then re-parse everything after it as options to the subcommand. This allows constructs like `cli subcommand --subcommand-flag --global-flag`. However, as a side effect, if `subcommand-flag` happens to be even a prefix of a global flag name, boost "helpfully" matches it with the global flag in the first pass so that the subcommand never even sees it. Fixing the issue of a subcommand flag conflicting with a global flag would break backwards compatibility; however, we can at least add an option to disable prefix matching so that there would need to be an exact flag name collision for this scenario to occur. It may be possible to extend NestedCommandLineApp in the future to detect flag collisions as well, instead of silently associating arguments with the wrong flag. Reviewed By: yfeldblum Differential Revision: D27419341 fbshipit-source-id: 941c0769e16d40c87f96620155f0ab09927cef3d
09cc63cb