NyaaCat / NyaaCore

Code infrastructure for all NyaaCat plugins
MIT License
22 stars 12 forks source link

Arguments.argString cannot be quoted with "`" #12

Closed Librazy closed 7 years ago

RecursiveG commented 7 years ago

You may want to quote whole key:value pair with ` see 88460ace70688eb4fd2c5befbc87ac2a2c9c772b

Librazy commented 7 years ago

And what if I simply need a argument that contains a :?

/rpitem description item add `Foo: bar`
`Foo: bar` should be parsed as a whole string "Foo: bar"
and Foo:`Foo bars` is a k-v pair
RecursiveG commented 7 years ago

Then just call nextString() as shown here.

Another demo:

String cmd = "`foo: bar` foo:foo:bar";
CommandReceiver.Arguments arg = CommandReceiver.Arguments.parse(cmd.split(" "));
arg.nextString(); // Returns "foo: bar"
arg.argString("foo"); // Returns "foo:bar"
Librazy commented 7 years ago

With key:`value` enabled, I can use syntax like

/rpgitem power item command cooldown:10 command:`say hi`
/heh search name:`Wood sword`

and I can make tab completion like

/rpgitem power item command
(tab)
/rpgitem power item command cooldown:`` mouse:`` command:``

instead of

/rpgitem power item command `cooldown:` ` mouse:` `command:`

which leads to lot of confusing.