diff --git a/base/src/redempt/ordinate/component/argument/VariableLengthArgumentComponent.java b/base/src/redempt/ordinate/component/argument/VariableLengthArgumentComponent.java index 5b5df65..fc0ebf5 100644 --- a/base/src/redempt/ordinate/component/argument/VariableLengthArgumentComponent.java +++ b/base/src/redempt/ordinate/component/argument/VariableLengthArgumentComponent.java @@ -70,10 +70,10 @@ public CommandResult parse(CommandContext context) { @Override public CommandResult complete(CommandContext context, Set completions) { - parse(context); if (context.getArguments().size() == 1) { completions.addAll(getType().complete(context, context.peekArg().getValue())); } + parse(context); return success(); } diff --git a/test/res/ordinate-test.ordn b/test/res/ordinate-test.ordn index 0dd9deb..0258f1e 100644 --- a/test/res/ordinate-test.ordn +++ b/test/res/ordinate-test.ordn @@ -51,7 +51,7 @@ consuming string...:arg { optionalConsuming string...:arg? { hook } -vararg int[]:nums { +vararg boolean[]:bools { hook } optionalVararg int[]:nums? { diff --git a/test/src/redempt/ordinate/test/OrdinateTest.java b/test/src/redempt/ordinate/test/OrdinateTest.java index 917d589..62d7ede 100644 --- a/test/src/redempt/ordinate/test/OrdinateTest.java +++ b/test/src/redempt/ordinate/test/OrdinateTest.java @@ -114,10 +114,11 @@ public void consumingTest() { @Test public void varargTest() { - tester.expect("vararg 1 2 3", Arrays.asList(1, 2, 3)); + tester.expect("vararg true false true", Arrays.asList(true, false, true)); tester.expectFailure("vararg"); tester.expect("optionalVararg 1 2 3", Arrays.asList(1, 2, 3)); tester.expect("optionalVararg", Collections.emptyList()); + tester.expectCompletions("vararg ", "true", "false"); } }