use of net.sourceforge.argparse4j.inf.ArgumentParser in project helios by spotify.
the class JobCreateCommandTest method setUp.
@Before
public void setUp() {
// use a real, dummy Subparser impl to avoid having to mock out every single call
final ArgumentParser parser = ArgumentParsers.newArgumentParser("test");
final Subparser subparser = parser.addSubparsers().addParser("create");
final Supplier<Map<String, String>> envVarSupplier = new Supplier<Map<String, String>>() {
@Override
public Map<String, String> get() {
return ImmutableMap.copyOf(envVars);
}
};
command = new JobCreateCommand(subparser, envVarSupplier);
when(client.createJob(argThat(matchesName(JOB_NAME)))).thenReturn(immediateFuture(new CreateJobResponse(CreateJobResponse.Status.OK, Collections.<String>emptyList(), "12345")));
}
use of net.sourceforge.argparse4j.inf.ArgumentParser in project helios by spotify.
the class JobInspectCommandTest method setUp.
@Before
public void setUp() {
// use a real, dummy Subparser impl to avoid having to mock out every single call
final ArgumentParser parser = ArgumentParsers.newArgumentParser("test");
final Subparser subparser = parser.addSubparsers().addParser("inspect");
command = new JobInspectCommand(subparser, TimeZone.getTimeZone("UTC"));
when(client.jobs(JOB_NAME_VERSION)).thenReturn(Futures.immediateFuture(jobs));
}
use of net.sourceforge.argparse4j.inf.ArgumentParser in project helios by spotify.
the class JobStatusCommandTest method setUp.
@Before
public void setUp() {
// use a real, dummy Subparser impl to avoid having to mock out every single call
final ArgumentParser parser = ArgumentParsers.newArgumentParser("test");
final Subparser subparser = parser.addSubparsers().addParser("list");
command = new JobStatusCommand(subparser);
}
use of net.sourceforge.argparse4j.inf.ArgumentParser in project cogcomp-nlp by CogComp.
the class MainClass method main.
public static void main(String[] args) throws Exception {
ArgumentParser parser = ArgumentParsers.newArgumentParser("MainClass", true);
parser.addArgument("-r", "--train").type(String.class).help("The training file in CoNLL format").setDefault("");
parser.addArgument("-t", "--test").help("The test file in CoNLL format");
parser.addArgument("-c", "--config").help("The SL configuration file").setDefault("config/StructuredPerceptron.config");
parser.addArgument("-m", "--model").help("The model output file").setDefault("out.model");
parser.addArgument("-p", "--pos").help("The type of PoS tags to use").choices("gold", "auto").setDefault("auto");
parser.addArgument("-o", "--offset").type(Integer.class).help("The offset of the pos/head/dep index for the CoNLL train/test files").setDefault(0);
parser.addArgument("-a", "--annotate").type(String.class).help("Annotate text file (one sentence per line) and print the output to the command line").setDefault("");
Namespace ns = parser.parseArgs(args);
useGoldPOS = ns.getString("pos").equals("gold");
logger.info("Using {} PoS tags", ns.getString("pos"));
conllIndexOffset = ns.getInt("offset");
if (!ns.getString("train").isEmpty()) {
logger.info("Using {} configuration", ns.getString("config"));
train(ns.getString("train"), ns.getString("config"), ns.getString("model"));
logger.info("Testing on Training Data");
test(ns.getString("model"), ns.getString("train"), false);
}
if (!ns.getString("test").isEmpty()) {
logger.info("Testing on Test Data");
test(ns.getString("model"), ns.getString("test"), true);
}
if (!ns.getString("annotate").isEmpty()) {
annotate(ns.getString("annotate"));
}
}
use of net.sourceforge.argparse4j.inf.ArgumentParser in project pcgen by PCGen.
the class Main method getParser.
/**
* @return an ArgumentParser used to peform argument parsing
*/
private static ArgumentParser getParser() {
ArgumentParser parser = ArgumentParsers.newArgumentParser(Constants.APPLICATION_NAME).defaultHelp(false).description("RPG Character Generator").version(PCGenPropBundle.getVersionNumber());
parser.addArgument("-v", "--verbose").help("verbose logging").type(Boolean.class).action(Arguments.count());
parser.addArgument("-V", "--version").action(Arguments.version());
parser.addArgument("-J").help("ignore java version checks").action(Arguments.storeTrue());
MutuallyExclusiveGroup startupMode = parser.addMutuallyExclusiveGroup().description("start up on a specific mode");
startupMode.addArgument("-G", "--gmgen").help("GMGen mode").type(Boolean.class).action(Arguments.storeTrue());
startupMode.addArgument("-N", "--npc").help("NPC generation mode").type(Boolean.class).action(Arguments.storeTrue());
startupMode.addArgument("--name-generator").help("run the name generator").type(Boolean.class).action(Arguments.storeTrue());
startupMode.addArgument("-D", "--tab").nargs(1);
parser.addArgument("-s", "--settingsdir").nargs(1).type(Arguments.fileType().verifyIsDirectory().verifyCanRead().verifyExists());
parser.addArgument("-m", "--campaignmode").nargs(1).type(String.class);
parser.addArgument("-E", "--exportsheet").nargs(1).type(Arguments.fileType().verifyCanRead().verifyExists().verifyIsFile());
parser.addArgument("-o", "--outputfile").nargs(1).type(Arguments.fileType().verifyCanCreate().verifyCanWrite().verifyNotExists());
parser.addArgument("-c", "--character").nargs(1).type(Arguments.fileType().verifyCanRead().verifyExists().verifyIsFile());
parser.addArgument("-p", "--party").nargs(1).type(Arguments.fileType().verifyCanRead().verifyExists().verifyIsFile());
return parser;
}
Aggregations