Skip to content

Command line parsing with CLI11 #13

Description

@philippeverley

There is no command line management system in TROLL. It is hard coded in the main function.

           for(int argn=1;argn<argc;argn++){ // Arguments of the input and output files
                if(*argv[argn] == '-'){
                    switch(*(argv[argn]+1)){
                        case 'i':
                            Config::bufi = argv[argn]+2;
                            break;
                        case 'd':                       // new v.3.0; initialisation of daytime variation in a separate file ('d' for daytime variation)
                            Config::bufi_daytimevar = argv[argn]+2;
                            break;
                        case 'm':                       // new v.2.4; initialisation of climate parameters from separate file ('m' for meterology)
                            Config::bufi_climate = argv[argn]+2;
                            break;
                        case 'p':                       // new v.3.0; initialisation of soil parameters from separate file ('p' for pedology)
                            Config::bufi_soil = argv[argn]+2;
                            break;
                        case 's':                       // new v.3.0; initialisation of species parameters from separate file
                            Config::bufi_species = argv[argn]+2;
                            break;
                        case 'o':
                            Config::buf = argv[argn]+2;
                            break;
                        case 'f':                      // new v.2.3: initialisation from field, 'f' for "forest", "field data"
                            Config::bufi_data = argv[argn]+2;
                            Config::_FromInventory = 1;        // new v.3.1: automatic recognition of whether data sheet is provided or not
                            break;
                        case 'w':                      // new v.2.3: initialisation from field, 'f' for "forest", "field data"
                            Config::bufi_dataSWC = argv[argn]+2;
                            break;
                        case 'l':
                            Config::bufi_pointcloud = argv[argn]+2;  // new v.3.1.6: output of simulated point clouds for TROLL-created stands
                            Config::_OUTPUT_pointcloud = 1;
                            break;
                        case 'n':
                            easympi_rank=atoi(argv[argn]+2); // new v.2.2
                            
                    }
                }
            }

After a quick review, I suggest to you CLI11 command line parser to handle input arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions