Add greedy charset option to string argument #131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements the concept of "greedy charsets" for brigadier string argument types.
Currently, word / quotable phrase arguments have a strict charset. For quotable phrase arguments, you can simply wrap the argument in quotes to allow these characters. However, for word arguments, you cannot use other characters at all. This is quite limiting, as even characters as simple as = are not allowed. This also blocks pretty much all international characters, making these argument types inconvenient to use.
In order to keep backward compatibility, a new "greedy charset" field has been added to the string argument types. This allows words/quoted strings to allow a much wider range of characters. StringReader also now has "greedy" methods, which will act as a way to have this functionality in other custom argument types if wanted. This means that any previous use of the argument/StringReader methods will use the legacy behavior.
Word argument
Before:
Note: Word arguments can't even be quoted, so it's impossible to use these characters.
After:
(with greedy charset)
String argument
Before:
After:
(with greedy charset)
Note, that we no longer need to wrap the argument in quotes with these characters.
Fixes
Fixes #103
Fixes #44