1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-02 05:33:53 +00:00

Style updates

This commit is contained in:
Henry Fredrick Schreiner 2017-10-27 14:07:10 -04:00 committed by Henry Schreiner
parent 6d26440b6e
commit 8cdf1c8651
4 changed files with 15 additions and 18 deletions

View File

@ -18,9 +18,7 @@ void setup_subcommand_a( CLI::App& app ) {
sub->add_flag("--with-foo", opt->with_foo, "Counter");
// Set the run function as callback to be called when this subcommand is issued.
sub->set_callback([opt]() {
run_subcommand_a( *opt );
});
sub->set_callback([opt]() { run_subcommand_a(*opt); });
// Note: In C++14, you could make a unique pointer, then pass it into the lambda function via
// a move. That's slightly more elegant, but you won't be able to see the runtime difference
@ -30,8 +28,7 @@ void setup_subcommand_a( CLI::App& app ) {
/// The function that runs our code.
/// This could also simply be in the callback lambda itself,
/// but having a separate function is cleaner.
void run_subcommand_a( SubcommandAOptions const& opt )
{
void run_subcommand_a(SubcommandAOptions const &opt) {
// Do stuff...
std::cout << "Working on file: " << opt.file << std::endl;
if(opt.with_foo) {