Exemplo n.º 1
0
        Clara::CommandLine<Options> CreateCommandLine()
        {
            Clara::CommandLine<Options> commandLine;

            commandLine.setThrowOnUnrecognisedTokens(true);
            commandLine.bindProcessName(&Options::processName);

            commandLine["-h"]["--help"]
                .describe("display usage information")
                .bind(&Options::showHelp);

            commandLine["-l"]["--list-types"]
                .describe("list all types parsed")
                .bind(&Options::listTypes);

            commandLine["-v"]["--verbose"]
                .describe("parse with clang in verbose mode")
                .bind(&Options::verbose);

            commandLine["-f"]["--file"]
                .describe("filename of the workspace to parse")
                .bind(&Options::filename, "filename");

            commandLine["-o"]["--outputdir"]
                .describe("output directory")
                .bind(&Options::outputDir, "path");

            return commandLine;
        }
Exemplo n.º 2
0
    inline Clara::CommandLine<ConfigData> makeCommandLineParser() {

        Clara::CommandLine<ConfigData> cli;

        cli.bindProcessName( &ConfigData::processName );

        cli.bind( &ConfigData::showHelp )
            .describe( "display usage information" )
            .shortOpt( "?")
            .shortOpt( "h")
            .longOpt( "help" );

        cli.bind( &ConfigData::listTests )
            .describe( "list all/matching test cases" )
            .shortOpt( "l")
            .longOpt( "list-tests" );

        cli.bind( &ConfigData::listTags )
            .describe( "list all/matching tags" )
            .shortOpt( "t")
            .longOpt( "list-tags" );

        cli.bind( &ConfigData::showSuccessfulTests )
            .describe( "include successful tests in output" )
            .shortOpt( "s")
            .longOpt( "success" );

        cli.bind( &ConfigData::shouldDebugBreak )
            .describe( "break into debugger on failure" )
            .shortOpt( "b")
            .longOpt( "break" );

        cli.bind( &ConfigData::noThrow )
            .describe( "skip exception tests" )
            .shortOpt( "e")
            .longOpt( "nothrow" );

        cli.bind( &ConfigData::outputFilename )
            .describe( "output filename" )
            .shortOpt( "o")
            .longOpt( "out" )
            .hint( "filename" );

        cli.bind( &ConfigData::reporterName )
            .describe( "reporter to use (defaults to console)" )
            .shortOpt( "r")
            .longOpt( "reporter" )
//            .hint( "name[:filename]" );
            .hint( "name" );

        cli.bind( &ConfigData::name )
            .describe( "suite name" )
            .shortOpt( "n")
            .longOpt( "name" )
            .hint( "name" );

        cli.bind( &abortAfterFirst )
            .describe( "abort at first failure" )
            .shortOpt( "a")
            .longOpt( "abort" );

        cli.bind( &abortAfterX )
            .describe( "abort after x failures" )
            .shortOpt( "x")
            .longOpt( "abortx" )
            .hint( "number of failures" );

        cli.bind( &addWarning )
            .describe( "enable warnings" )
            .shortOpt( "w")
            .longOpt( "warn" )
            .hint( "warning name" );

//        cli.bind( &setVerbosity )
//            .describe( "level of verbosity (0=no output)" )
//            .shortOpt( "v")
//            .longOpt( "verbosity" )
//            .hint( "level" );

        cli.bind( &addTestOrTags )
            .describe( "which test or tests to use" )
            .hint( "test name, pattern or tags" );

        cli.bind( &setShowDurations )
            .describe( "show test durations" )
            .shortOpt( "d")
            .longOpt( "durations" )
            .hint( "yes/no" );

        cli.bind( &loadTestNamesFromFile )
            .describe( "load test names to run from a file" )
            .shortOpt( "f")
            .longOpt( "input-file" )
            .hint( "filename" );

        // Less common commands which don't have a short form
        cli.bind( &ConfigData::listTestNamesOnly )
            .describe( "list all/matching test cases names only" )
            .longOpt( "list-test-names-only" );

        cli.bind( &ConfigData::listReporters )
            .describe( "list all reporters" )
            .longOpt( "list-reporters" );


        return cli;
    }