-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
add: TemporalArgumentParser #1748
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我不推荐用反射实现
mirai-console/backend/mirai-console/src/command/descriptor/CommandArgumentContext.kt
Show resolved
Hide resolved
mirai-console/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt
Outdated
Show resolved
Hide resolved
For mamoe, after merge: Mark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some tests
mirai-console/backend/mirai-console/test/command/TestCommand.kt
Outdated
Show resolved
Hide resolved
/** | ||
* 解析参数为时间 [T] | ||
* @param now 返回当前时间 | ||
* @param parse 从字符串解析时间 | ||
*/ | ||
public class TemporalArgumentParser<T : TemporalAccessor>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
由于设置不允许 maintainer 修改, 请标注 @MiraiExperimentalApi
, 注释 @since 2.10
, 准备合并
conflicts? |
* add: TemporalArgumentParser * fix: no reflect * fix: delete @Suppress("UNCHECKED_CAST") * fix: Temporal -> TemporalAccessor * add: test temporal argument * add: isInstance * docs: since 2.10 * docs: since 2.10
添加
TemporalArgumentParser
类似EnumValueArgumentParser
,自动完成
LocalDate
OffsetDateTime
等java.time.temporal.Temporal
实现类 的 解析