Skip to content

Commit

Permalink
fixed that set of initialized arguments of repeated subcommand is not…
Browse files Browse the repository at this point in the history
… used by previous occurence of the same subcommand
  • Loading branch information
sfeuerhahn authored and remkop committed Jun 8, 2021
1 parent 7f7889e commit 36b882d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -13287,12 +13287,14 @@ private void processArguments(List<CommandLine> parsedCommands,
if (commandSpec.parent() != null && commandSpec.parent().subcommandsRepeatable() && commandSpec.parent().subcommands().containsKey(arg)) {
tracer.debug("'%s' is a repeatable subcommand of %s%n", arg, commandSpec.parent().qualifiedName());// #454 repeatable subcommands
CommandLine subcommand = commandSpec.parent().subcommands().get(arg);
Set<ArgSpec> inheritedInitialized = initialized;
if (subcommand.interpreter.parseResultBuilder != null) {
tracer.debug("Subcommand '%s' has been matched before. Making a copy...%n", subcommand.getCommandName());
subcommand = subcommand.copy();
subcommand.getCommandSpec().parent(commandSpec.parent()); // hook it up with its parent
inheritedInitialized = new LinkedHashSet<>(inheritedInitialized);
}
processSubcommand(subcommand, getParent().interpreter.parseResultBuilder, parsedCommands, args, required, initialized, originalArgs, nowProcessing, separator, arg);
processSubcommand(subcommand, getParent().interpreter.parseResultBuilder, parsedCommands, args, required, inheritedInitialized, originalArgs, nowProcessing, separator, arg);
continue;
}

Expand Down

0 comments on commit 36b882d

Please sign in to comment.