-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: 新增配置项,用于自定义主指令与子指令间的分隔符 #476
Comments
如何确保
|
这个问题其实在历史上讨论过好几回,结论是不怎么好做,因为 parsing argv 的时候会需要额外多出好几步出来,本来第一个词是且仅可能是指令,但是改成空格分割的话从第一个词开始后面的好几个词都可能是指令。 而且当前的解析会将次级指令和参数混淆。就我所知, koishi 当前的 argv parsing 只能检查一个指令参数的个数是否达标,并不能指定一个指令能否携带参数。就算一个指令是 0 参数指令(这可能是你希望的区别父子指令的方法,虽然这本身仍然有问题),它也和其他的带参数指令地位相同,它后面的参数一样会被解析进去(只是不起作用)。 所以结论基本上都是:要么用一些手段(比如 alias、shortcut、plugin-teach 桥接等等),要么就手搓一个次级指令系统(我这么干过,后来摸了),再要么…… |
在特定情况下也未必产生二义性。如果 arc 本身没有提供 action,那么将 arc b30 重定向到 arc.b30 就是安全的。如果将这个重定向作为一种默认行为也是一种解决方案。 另一方面,我认为允许自定义子指令的分隔符较难实现。如果有需求还是尽量考虑上文中介绍的其他思路。 |
感谢解答。 现在思路是在主指令 |
Describe the problem related to the feature request
比如输入派生式子指令
/arc.b30
,需要多打一个.
而直接用
/arc b30
就会方便很多。翻了文档和各种config好像没有相关的配置项(?)
Describe the solution you'd like
添加一个配置项,用于控制派生式子指令与主指令间的分隔符
Describe alternatives you've considered
手动为指令添加类似于
arc b30
的alias或者shortcut...但显然不是好的办法Additional context
Koishi 4.0.1
Node 14.17.6
The text was updated successfully, but these errors were encountered: