类org.apache.commons.cli.AlreadySelectedException源码实例Demo

下面列出了怎么用org.apache.commons.cli.AlreadySelectedException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: rdf4j   文件: CmdLineParser.java
/**
 * Handle command line caution group
 *
 * @return location of the (remote or local) repository
 */
protected boolean handleCautionGroup() {
	ConsoleIO io = console.getConsoleIO();

	try {
		if (commandLine.hasOption(FORCE.getOpt())) {
			CAUTION_GROUP.setSelected(FORCE);
			io.setForce();
		}
		if (commandLine.hasOption(CAUTIOUS.getOpt())) {
			CAUTION_GROUP.setSelected(CAUTIOUS);
			io.setCautious();
		}
	} catch (AlreadySelectedException e) {
		printUsage();
		return false;
	}
	return true;
}
 
源代码2 项目: rdf4j   文件: CmdLineParser.java
/**
 * Handle command line location group
 *
 * @return location of the (remote or local) repository
 */
protected String handleLocationGroup() {
	String location = null;

	try {
		if (commandLine.hasOption(DIRECTORY.getOpt())) {
			LOCATION_GROUP.setSelected(DIRECTORY);
			location = commandLine.getOptionValue(DIRECTORY.getOpt());
		}
		if (commandLine.hasOption(SERVER.getOpt())) {
			LOCATION_GROUP.setSelected(SERVER);
			location = commandLine.getOptionValue(SERVER.getOpt());
		}
	} catch (AlreadySelectedException e) {
		printUsage();
	}
	return location;
}
 
源代码3 项目: systemds   文件: CLIOptionsParserTest.java
@Test(expected = AlreadySelectedException.class)
public void testBadHelp() throws Exception {
	String cl = "systemds -help -clean";
	String[] args = cl.split(" ");
	DMLOptions o = DMLOptions.parseCLArguments(args);
	Assert.assertEquals(true, o.help);
}
 
@Test
public void testParseArgument_duplicateOptions_coordinates_file() throws ParseException {
  try {
    DashboardArguments.readCommandLine(
        "-c", "com.google.cloud:libraries-bom:1.0.0", "-f", "../pom.xml");
    Assert.fail("The argument should validate duplicate input");
  } catch (AlreadySelectedException ex) {
    // pass
  }
}
 
@Test
public void testParseArgument_duplicateOptions_coordinates_allVersions() throws ParseException {
  try {
    DashboardArguments.readCommandLine(
        "-c", "com.google.cloud:libraries-bom:1.0.0", "-a", "com.google.cloud:libraries-bom");
    Assert.fail("The argument should validate duplicate input");
  } catch (AlreadySelectedException ex) {
    // pass
  }
}
 
源代码6 项目: systemds   文件: CLIOptionsParserTest.java
@Test(expected = AlreadySelectedException.class)
public void testBadHelp() throws Exception {
	String cl = "systemds -help -clean";
	String[] args = cl.split(" ");
	DMLOptions o = DMLOptions.parseCLArguments(args);
	Assert.assertEquals(true, o.help);
}
 
源代码7 项目: systemds   文件: CLIOptionsParserTest.java
@Test(expected = AlreadySelectedException.class)
public void testBadClean() throws Exception {
	String cl = "systemds -clean -f test.dml";
	String[] args = cl.split(" ");
	DMLOptions.parseCLArguments(args);
}
 
源代码8 项目: systemds   文件: CLIOptionsParserTest.java
@Test(expected = AlreadySelectedException.class)
public void testBadScript() throws Exception {
	String cl = "systemds -f test.dml -s \"print('hello')\"";
	String[] args = cl.split(" ");
	DMLOptions.parseCLArguments(args);
}
 
源代码9 项目: systemds   文件: CLIOptionsParserTest.java
@Test(expected = AlreadySelectedException.class)
public void testBadClean() throws Exception {
	String cl = "systemds -clean -f test.dml";
	String[] args = cl.split(" ");
	DMLOptions.parseCLArguments(args);
}
 
源代码10 项目: systemds   文件: CLIOptionsParserTest.java
@Test(expected = AlreadySelectedException.class)
public void testBadScript() throws Exception {
	String cl = "systemds -f test.dml -s \"print('hello')\"";
	String[] args = cl.split(" ");
	DMLOptions.parseCLArguments(args);
}