22
33#include " utils/StringUtils.h"
44#include " utils/CLIUtils.h"
5+ #include " loguru.h"
56#include " config.h"
67
78uint32_t Commands::threadsPerUser = 0 ;
89uint32_t Commands::kleeProcessNumber = 0 ;
910
1011Commands::MainCommands::MainCommands (CLI::App &app) {
1112 app.set_help_all_flag (" --help-all" , " Expand all help" );
12- app.add_flag_function (" --version" , [](int count){
13+ app.add_flag_function (" --version" , [](int count) {
1314 std::cout << PROJECT_NAME << " " << PROJECT_VERSION << std::endl;
1415 if (strlen (RUN_INFO)) {
1516 std::cout << " Build by " << RUN_INFO << std::endl;
1617 }
1718 exit (0 );
1819 }, " Get UTBotCpp version and build detail" );
20+
21+ app.add_option (" -v,--verbosity" , verbosity, " Logger verbosity." )
22+ ->type_name (" ENUM:value in {" +
23+ StringUtils::joinWith (CollectionUtils::getKeys (verbosityMap), " |" ) + " }" )
24+ ->transform (CLI::CheckedTransformer (verbosityMap, CLI::ignore_case));
25+ app.add_option (" --log" , logPath, " Path to folder with logs." );
26+
1927 serverCommand = app.add_subcommand (" server" , " Launch UTBot server." );
2028 generateCommand =
21- app.add_subcommand (" generate" , " Generate unit tests and/or stubs." )->require_subcommand ();
29+ app.add_subcommand (" generate" , " Generate unit tests and/or stubs." )->require_subcommand ();
2230 runTestsCommand = app.add_subcommand (" run" , " Launch unit tests and generate coverage info." );
2331 allCommand = app.add_subcommand (
24- " all" , " Sequential launch of 'generate stubs' -> 'generate project' -> 'run'." );
32+ " all" , " Sequential launch of 'generate stubs' -> 'generate project' -> 'run'." );
2533 app.require_subcommand (0 , 1 );
2634}
2735
@@ -45,25 +53,20 @@ CLI::App *Commands::MainCommands::getAllCommand() {
4553Commands::ServerCommandOptions::ServerCommandOptions (CLI::App *command) {
4654 command->add_option (" -p,--port" , port, " Port server run on." );
4755 command->add_option (" -j" , threadsPerUser, " Maximum number of threads per user." );
48- command->add_option (" --log" , logPath, " Path to folder with logs." );
49- command->add_option (" -v,--verbosity" , verbosity, " Logger verbosity." )
50- ->type_name (" ENUM:value in {" +
51- StringUtils::joinWith (CollectionUtils::getKeys (verbosityMap), " |" ) + " }" )
52- ->transform (CLI::CheckedTransformer (verbosityMap, CLI::ignore_case));
5356 command->add_option (" --klee-process-number" , kleeProcessNumber,
5457 " Number of threads for KLEE in interactive mode" );
5558}
5659
57- fs::path Commands::ServerCommandOptions ::getLogPath () {
60+ fs::path Commands::MainCommands ::getLogPath () {
5861 return logPath;
5962}
6063
61- unsigned int Commands::ServerCommandOptions::getPort () {
62- return port ;
64+ loguru::NamedVerbosity Commands::MainCommands::getVerbosity () {
65+ return verbosity ;
6366}
6467
65- loguru::NamedVerbosity Commands::ServerCommandOptions::getVerbosity () {
66- return verbosity ;
68+ unsigned int Commands::ServerCommandOptions::getPort () {
69+ return port ;
6770}
6871
6972unsigned int Commands::ServerCommandOptions::getThreadsPerUser () {
@@ -74,7 +77,7 @@ unsigned int Commands::ServerCommandOptions::getKleeProcessNumber() {
7477 return kleeProcessNumber;
7578}
7679
77- const std::map<std::string, loguru::NamedVerbosity> Commands::ServerCommandOptions ::verbosityMap = {
80+ const std::map<std::string, loguru::NamedVerbosity> Commands::MainCommands ::verbosityMap = {
7881 { " trace" , loguru::NamedVerbosity::Verbosity_MAX },
7982 { " debug" , loguru::NamedVerbosity::Verbosity_1 },
8083 { " info" , loguru::NamedVerbosity::Verbosity_INFO },
0 commit comments