[PATCH] D61574: [CommandLine] Allow Options to specify multiple OptionCategory's.

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 15:09:23 PDT 2019


hintonda added a comment.

In D61574#1491471 <https://reviews.llvm.org/D61574#1491471>, @MaskRay wrote:

> May I ask you to share some dumps of `some-command -help` (a demo how you'll make use of the multiple categories)😁


Here's a dump of the test I was attempting to add with the following options:

  cl::OptionCategory Cat1("Category One", "  Category One description");
  cl::OptionCategory Cat2("Category Two", "  Category Two description");
  cl::opt<bool> GeneralOpt("general-option");
  cl::opt<bool> Cat1Opt("category1-option", cl::cat(Cat1));
  cl::opt<bool> Cat2Opt("category2-option", cl::cat(Cat2));
  cl::opt<bool> Cat1AndCat2Opt("category1-and-category2-option", cl::cat(Cat1), cl::cat(Cat2));



  USAGE: prog [options]
  
  OPTIONS:
  
  Category One:
    Category One description
  
    --category1-and-category2-option    -
    --category1-option                  -
  
  Category Two:
    Category Two description
  
    --category1-and-category2-option    -
    --category2-option                  -
  
  Color Options:
  
    --color                             - Use colors in output (default=autodetect)
  
  General options:
  
    --env-test-opt=<string>             -
    --general-option                    -
    --program-test-string-arg1=<string> -
    --program-test-string-arg2=<string> -
    --time-trace-granularity=<uint>     - Minimum time granularity (in microseconds) traced by time profiler
  
  Generic Options:
  
    --help                              - Display available options (--help-hidden for more)
    --help-list                         - Display list of available options (--help-list-hidden for more)
    --version                           - Display the version of this program


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61574/new/

https://reviews.llvm.org/D61574





More information about the llvm-commits mailing list