-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I propose that we turn argument handling into an interface that can both provide arguments and parse them. This will also have to be reflected in the API for commands, so something like this:
void addArgumentHandler(int position, ArgumentHandler argumentHandler);And then provide an interface like this:
public interface ArgumentHandler<T> {
public T validate(String argument);
public List<String> provideCompletions(String partial);
}Perhaps a utility method on this interface might be good to unify separate validators and tab completers.
Another thing that we might consider is how these are passed down to commands. We register the handlers in the commands, should they be added to some kind of map that we can be sure will be of valid types? I'm not entirely sure how I want to implement this as of right now, but that might be a good option. I want to try and avoid casts if at all possible.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels