/** Adds the specified positional parameter spec to the list of configured arguments to expect. * The positional parameter's {@linkplain PositionalParamSpec#description()} may * now return Strings from this CommandSpec's {@linkplain UsageMessageSpec#messages() messages}. * The positional parameter's {@linkplain PositionalParamSpec#defaultValueString()} may * now return Strings from this CommandSpec's {@link CommandSpec#defaultValueProvider()} IDefaultValueProvider}. * @param positional the positional parameter spec to add * @return this CommandSpec for method chaining */ public CommandSpec addPositional(PositionalParamSpec positional) { args.add(positional); positionalParameters.add(positional); if (positional.required()) { requiredArgs.add(positional); } positional.messages(usageMessage().messages()); positional.commandSpec = this; return this; }
/** Adds the specified positional parameter spec to the list of configured arguments to expect. * The positional parameter's {@linkplain PositionalParamSpec#description()} may * now return Strings from this CommandSpec's {@linkplain UsageMessageSpec#messages() messages}. * The positional parameter's {@linkplain PositionalParamSpec#defaultValueString()} may * now return Strings from this CommandSpec's {@link CommandSpec#defaultValueProvider()} IDefaultValueProvider}. * @param positional the positional parameter spec to add * @return this CommandSpec for method chaining */ public CommandSpec addPositional(PositionalParamSpec positional) { args.add(positional); positionalParameters.add(positional); if (positional.required()) { requiredArgs.add(positional); } positional.messages(usageMessage().messages()); positional.commandSpec = this; return this; }
@Test public void testPositionalDefaultRequiredIsFalse() { assertFalse(CommandLine.Model.PositionalParamSpec.builder().build().required()); } @Test
@Test public void testPositionalDefaultRequiredIsFalse() { assertFalse(CommandLine.Model.PositionalParamSpec.builder().build().required()); } @Test