fix help switch
This commit is contained in:
parent
3cdc7431ad
commit
7402a19732
|
@ -68,6 +68,7 @@ CLIParser::CLIParser(int argc, char *argv[])
|
|||
// --help option
|
||||
if (vm_.count("help")) {
|
||||
std::cout << "DBT-RISE-RiscV simulator for RISC-V" << std::endl << desc << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
po::notify(vm_); // throws on error, so do after help in case there are any problems
|
||||
valid = true;
|
||||
|
@ -76,7 +77,7 @@ CLIParser::CLIParser(int argc, char *argv[])
|
|||
std::cerr << desc << std::endl;
|
||||
}
|
||||
|
||||
auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as<unsigned>() : vm_["verbose"].as<unsigned>();
|
||||
auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as<unsigned>() : vm_.count("verbose") ? vm_["verbose"].as<unsigned>() : 3;
|
||||
auto colored_output = vm_["Verbose"].defaulted();
|
||||
auto dbg_level = vm_.count("debug-level")
|
||||
? vm_["debug-level"].as<scc::log>()
|
||||
|
@ -109,7 +110,7 @@ void CLIParser::build() {
|
|||
// clang-format off
|
||||
desc.add_options()
|
||||
("help,h", "Print help message")
|
||||
("verbose,v", po::value<unsigned>()->implicit_value(3), "Sets logging verbosity")
|
||||
("verbose,v", po::value<unsigned>()->implicit_value(4), "Sets logging verbosity")
|
||||
("Verbose,V", po::value<unsigned>()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored")
|
||||
("debug-level,D", po::value<scc::log>(), "Debug output level (textual) as with --verbose")
|
||||
("log-file", po::value<std::string>(), "Sets default log file.")
|
||||
|
|
|
@ -69,9 +69,9 @@ int sc_main(int argc, char *argv[]) {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// CLI argument parsing & logging setup
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
CLIParser parser(argc, argv);
|
||||
scc::stream_redirection cout_redir(std::cout, scc::log::INFO);
|
||||
scc::stream_redirection cerr_redir(std::cerr, scc::log::ERROR);
|
||||
CLIParser parser(argc, argv);
|
||||
if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// set up infrastructure
|
||||
|
@ -116,7 +116,7 @@ int sc_main(int argc, char *argv[]) {
|
|||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.dump_ir", parser.is_set("dump-ir"));
|
||||
if (parser.is_set("elf"))
|
||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", parser.get<std::string>("elf"));
|
||||
else {
|
||||
else if (parser.is_set("argv")){
|
||||
auto args = parser.get<std::vector<std::string>>("argv");
|
||||
if(args.size())
|
||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);
|
||||
|
|
Loading…
Reference in New Issue