Skip to content

Commit

Permalink
[#1010] (work in progress) plan for making CommandSpec.copy robust ag…
Browse files Browse the repository at this point in the history
…ainst programmatic changes
  • Loading branch information
remkop committed Apr 29, 2020
1 parent 7aea025 commit 10c2c96
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -5431,7 +5431,20 @@ private CommandSpec copy() {
// TODO if this CommandSpec was created/modified via the programmatic API,
// we need to copy all attributes that are modifiable via the programmatic API
// and point them to this CommandSpec instance.

// result.commands.clear(); result.commands.putAll(this.commands);
// result.optionsByNameMap.clear(); result.optionsByNameMap.putAll(this.optionsByNameMap);
// result.negatedOptionsByNameMap.clear(); result.negatedOptionsByNameMap.putAll(this.negatedOptionsByNameMap);
// result.posixOptionsByKeyMap.clear(); result.posixOptionsByKeyMap.putAll(this.posixOptionsByKeyMap);
// result.mixins.clear(); result.mixins.putAll(this.mixins);
// result.mixinAnnotatedElements.clear(); result.mixinAnnotatedElements.putAll(this.mixinAnnotatedElements);
// result.requiredArgs.clear(); result.requiredArgs.addAll(requiredArgs);
// result.args.clear(); result.args.addAll(args);
// result.options.clear(); result.options.addAll(options);
// result.positionalParameters.clear(); result.positionalParameters.addAll(positionalParameters);
// result.unmatchedArgs.clear(); result.unmatchedArgs.addAll(unmatchedArgs);
// result.specElements.clear(); result.specElements.addAll(specElements);
// result.parentCommandElements.clear(); result.parentCommandElements.addAll(parentCommandElements);
// result.groups.clear(); result.groups.addAll(groups);
return result;
}

Expand Down

0 comments on commit 10c2c96

Please sign in to comment.