How to access custom command line options from within a Catch2 test case?

Viewed 877

I added my own command line option using a custom main file†:

†https://github.com/catchorg/Catch2/blob/master/docs/own-main.md#adding-your-own-command-line-options

  // ...
  auto cli 
    = session.cli() // Get Catch's composite command line parser
    | Opt( height, "height" ) // bind variable to a new option, with a hint string
        ["-g"]["--height"]    // the option names it will respond to
        ("how high?");        // description string for the help output

  // ...
}

Now I want to use the height command line option from within a test case. What would be the best way to do this?

0 Answers
Related