Skip to content

Instantly share code, notes, and snippets.

@Limeth
Created December 20, 2014 14:23
Show Gist options
  • Save Limeth/684852a72d53090604a7 to your computer and use it in GitHub Desktop.
Save Limeth/684852a72d53090604a7 to your computer and use it in GitHub Desktop.
Command parameter completion
We have two options for implementing the command parameter suggestion:
A)
The CommandParameterAdapter (https://github.com/Limeth/Terasology/blob/develop/engine/src/main/java/org/terasology/logic/console/internal/adapter/CommandParameterAdapter.java) would have a method returning all possible cases, while a CommandParam would accept a Predicate-like object filtering those cases. The filtered cases would then be suggested after being composed to Strings by the corresponding CommandParameterAdapter.
B)
The CommandParam would accept a 'suggestion' parameter of a class implementing an interface with a return type of Object[] or Collection<Object>. The returned values would then be suggested after being composed to Strings by the corresponding CommandParameterAdapter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment