org.apache.commons.cli.AlreadySelectedException Java Examples
The following examples show how to use
org.apache.commons.cli.AlreadySelectedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CmdLineParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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; }
Example #2
Source File: CmdLineParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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; }
Example #3
Source File: CLIOptionsParserTest.java From systemds with Apache License 2.0 | 5 votes |
@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); }
Example #4
Source File: DashboardArgumentsTest.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
@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 } }
Example #5
Source File: DashboardArgumentsTest.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
@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 } }
Example #6
Source File: CLIOptionsParserTest.java From systemds with Apache License 2.0 | 5 votes |
@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); }
Example #7
Source File: CLIOptionsParserTest.java From systemds with Apache License 2.0 | 4 votes |
@Test(expected = AlreadySelectedException.class) public void testBadClean() throws Exception { String cl = "systemds -clean -f test.dml"; String[] args = cl.split(" "); DMLOptions.parseCLArguments(args); }
Example #8
Source File: CLIOptionsParserTest.java From systemds with Apache License 2.0 | 4 votes |
@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); }
Example #9
Source File: CLIOptionsParserTest.java From systemds with Apache License 2.0 | 4 votes |
@Test(expected = AlreadySelectedException.class) public void testBadClean() throws Exception { String cl = "systemds -clean -f test.dml"; String[] args = cl.split(" "); DMLOptions.parseCLArguments(args); }
Example #10
Source File: CLIOptionsParserTest.java From systemds with Apache License 2.0 | 4 votes |
@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); }