/** * Add an option to the command line. The values of the option are stored. * * @param opt the processed option * * @return this Builder instance for method chaining. */ public Builder addOption(Option opt) { commandLine.addOption(opt); return this; }
private void handleOption(Option option) throws ParseException { // check the previous option before handling the next one checkRequiredArgs(); option = (Option) option.clone(); updateRequiredOptions(option); cmd.addOption(option); if (option.hasArg()) { currentOption = option; } else { currentOption = null; } }
cmd.addOption(opt); updateRequiredOptions(opt);
@Test public void testGetOptions() { CommandLine cmd = new CommandLine(); assertNotNull(cmd.getOptions()); assertEquals(0, cmd.getOptions().length); cmd.addOption(new Option("a", null)); cmd.addOption(new Option("b", null)); cmd.addOption(new Option("c", null)); assertEquals(3, cmd.getOptions().length); }
cmd.addOption(opt);
/** * Add an option to the command line. The values of the option are stored. * * @param opt the processed option * * @return this Builder instance for method chaining. */ public Builder addOption(Option opt) { commandLine.addOption(opt); return this; }
cmd.addOption(opt);
cmd.addOption(opt); updateRequiredOptions(opt);
private void handleOption(Option option) throws ParseException { // check the previous option before handling the next one checkRequiredArgs(); option = (Option) option.clone(); updateRequiredOptions(option); cmd.addOption(option); if (option.hasArg()) { currentOption = option; } else { currentOption = null; } }
cmd.addOption(opt);