ListOptions listOptions = new ListOptions(commandLine); if (listOptions.isPrintHelp()) { CliFrontendParser.printHelpForList(customCommandLines); return; if (!listOptions.showRunning() && !listOptions.showScheduled() && !listOptions.showAll()) { showRunning = true; showScheduled = true; showAll = false; } else { showRunning = listOptions.showRunning(); showScheduled = listOptions.showScheduled(); showAll = listOptions.showAll();
ListOptions listOptions = new ListOptions(commandLine); if (listOptions.isPrintHelp()) { CliFrontendParser.printHelpForList(customCommandLines); return; if (!listOptions.getRunning() && !listOptions.getScheduled()) { running = true; scheduled = true; } else { running = listOptions.getRunning(); scheduled = listOptions.getScheduled();
if (options.isPrintHelp()) { CliFrontendParser.printHelpForList(); return 0; boolean running = options.getRunning(); boolean scheduled = options.getScheduled();
public static ListOptions parseListCommand(String[] args) throws CliArgsException { try { DefaultParser parser = new DefaultParser(); CommandLine line = parser.parse(LIST_OPTIONS, args, false); return new ListOptions(line); } catch (ParseException e) { throw new CliArgsException(e.getMessage()); } }
@Test public void testListOptions() throws Exception { // test configure all job { String[] parameters = {"-a"}; ListOptions options = new ListOptions(CliFrontendParser.parse( CliFrontendParser.getListCommandOptions(), parameters, true)); assertTrue(options.showAll()); assertFalse(options.showRunning()); assertFalse(options.showScheduled()); } // test configure running job { String[] parameters = {"-r"}; ListOptions options = new ListOptions(CliFrontendParser.parse( CliFrontendParser.getListCommandOptions(), parameters, true)); assertFalse(options.showAll()); assertTrue(options.showRunning()); assertFalse(options.showScheduled()); } // test configure scheduled job { String[] parameters = {"-s"}; ListOptions options = new ListOptions(CliFrontendParser.parse( CliFrontendParser.getListCommandOptions(), parameters, true)); assertFalse(options.showAll()); assertFalse(options.showRunning()); assertTrue(options.showScheduled()); } }
ListOptions listOptions = new ListOptions(commandLine); if (listOptions.isPrintHelp()) { CliFrontendParser.printHelpForList(customCommandLines); return; if (!listOptions.showRunning() && !listOptions.showScheduled() && !listOptions.showAll()) { showRunning = true; showScheduled = true; showAll = false; } else { showRunning = listOptions.showRunning(); showScheduled = listOptions.showScheduled(); showAll = listOptions.showAll();