commands icon indicating copy to clipboard operation
commands copied to clipboard

Option to automatically parse quoted input

Open jackah2 opened this issue 4 years ago • 2 comments

There is currently no parsing for input with quotes. For example, given /command "This should be one argument", the CommandExecutionContext args look like ["This, should, be, one, argument"]. Ideally, there would be an option in the command manager to pre-process arguments and group quoted one. In my example, this would resolve to a single arg, [This should be one argument]. This would be a solution to #253.

To expand on this, nested quotes could be escaped with \. Additionally, the method to set this behavior could take in a boolean to denote whether or not the quotes should remain in the parsed arguments.

jackah2 avatar Jan 22 '21 01:01 jackah2

I mean you can just define a command like this

@CommandAlias("command")
public void onSomeCommand(CommandSender sender, String someArgument) {
	sender.sendMessage("Argument: "+someArgument)
}

and then if you did /command blah blah blah, you would get back "Argument: blah blah blah" Though I don't think it does that if you had a command with more arguments after that.

sqlongithub avatar Mar 29 '21 19:03 sqlongithub

I mean you can just define a command like this

@CommandAlias("command")
public void onSomeCommand(CommandSender sender, String someArgument) {
	sender.sendMessage("Argument: "+someArgument)
}

and then if you did /command blah blah blah, you would get back "Argument: blah blah blah" Though I don't think it does that if you had a command with more arguments after that.

That's why this feature is useful. You can parse Strings with spaces between them, by using "".

stijnb1234 avatar Mar 29 '21 19:03 stijnb1234