Example #1
0
Argv::Argv(const Argv &v)
{
  _argc=0;
  _argv=NULL;
  if (v.argc())
    duplicate(_argc,_argv,v.argc(),v.argv());
}
bool CompilerInterface::restrictArgs(const char* selected_source,Argv &backup_args ) 
{
  FUNCTION_TRACE;
  int i;
  backup_args=param_args();

  Argv new_args;
  for (i=0;i<backup_args.argc();i++)
  {
    const char *file=backup_args[i];
    if (!isSource(file) || filename_strcmp(selected_source,file)==0)
      new_args.append(file);
  }

  setArgs(new_args);
  return true;
}
Example #3
0
    ("6,six", "a short number option")
    ;

  Argv argv({
    "tester",
    "--long",
    "-s",
    "--value",
    "value",
    "-a",
    "b",
    "-6"
  });

  char** actual_argv = argv.argv();
  auto argc = argv.argc();

  options.parse(argc, actual_argv);

  CHECK(options.count("long") == 1);
  CHECK(options.count("s") == 1);
  CHECK(options.count("value") == 1);
  CHECK(options.count("a") == 1);
  CHECK(options["value"].as<std::string>() == "value");
  CHECK(options["a"].as<std::string>() == "b");
  CHECK(options.count("6") == 1);
}

TEST_CASE("Short options", "[options]")
{
  cxxopts::Options options("test_short", " - test short options");