23 package com.realtime.crossfire.jxclient.commands;
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.regex.Pattern;
28 import org.jetbrains.annotations.NotNull;
63 public static Collection<CommandExec>
expand(@NotNull
final CharSequence commandList, @NotNull
final Commands commands) {
64 final Collection<CommandExec> list =
new ArrayList<>();
65 CharSequence remainingCommandList = commandList;
68 final String commandSpec = tmp[0];
69 if (!commandSpec.isEmpty()) {
71 final String commandName = tmp2[0];
72 final String commandArgs = tmp2.length == 2 ? tmp2[1] :
"";
73 final Command command = commands.findCommand(commandName);
74 if (command ==
null) {
77 final String[] tmp3 =
PATTERN_SPACES.split(remainingCommandList, 2);
78 list.add(
new CommandExec(command, tmp3.length == 2 ? tmp3[1] :
""));
87 remainingCommandList = tmp[1];