Skip to content

Commit

Permalink
feat: add tip for option --count usage (#223)
Browse files Browse the repository at this point in the history
* feat: add tip for option `--count` usage

* fix: `<i18n>` element only accept array

on the other hand, `session.text()` returns plain text in tsx, so it is not
suitable for i18n elements with other elements inside

* fix: use `.displayName` instead
  • Loading branch information
MaikoTan authored Mar 31, 2024
1 parent 0b452ad commit ac1ecb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function apply(ctx: Context, config: Config) {
return count
}

ctx
const command = ctx
.command('booru <query:text>')
.option('count', '-c <count:number>', { type: count, fallback: 1 })
.option('label', '-l <label:string>')
Expand Down Expand Up @@ -165,7 +165,7 @@ export function apply(ctx: Context, config: Config) {
output.push(
<p>
<i18n path='.tips'></i18n>
<i18n path={tip}></i18n>
<i18n path={tip}>{[command.displayName]}</i18n>
</p>,
)
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ booru:
- 不带参数调用此命令将会随机返回一张图片
- 可以使用 <code>-l &lt;label&gt;</code> 或 <code>--label &lt;label&gt;</code> 参数指定图源标签
- 可以使用 <code>-c &lt;count&gt;</code> 或 <code>--count &lt;count&gt;</code> 参数指定返回图片数量
- 使用 <code>{0} -c 3</code> 可以返回 3 张图片
- 指定的图片数量与实际返回的图片数量可能有所不同

0 comments on commit ac1ecb1

Please sign in to comment.