Skip to content

Commit a2f2684

Browse files
committed
docs: clarify staged concurrency behavior
1 parent 208bb15 commit a2f2684

2 files changed

Lines changed: 50 additions & 2 deletions

File tree

website/docs/en/guide/cli/staged.mdx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,36 @@ rs staged --allow-empty
2626

2727
### `--concurrent`
2828

29-
`--concurrent` (or `-p`) sets how many tasks run concurrently; use `false` to run them serially.
29+
`--concurrent` controls how many tasks may run at the same time. It accepts `true`, `false`, or a positive integer.
30+
31+
When the option is omitted, it defaults to `true`, so `rs staged` runs tasks concurrently without a fixed limit. Set it to `false` to run one task at a time, or use a positive integer to limit the number of concurrent tasks.
3032

3133
```bash
34+
# Use the default: run tasks concurrently without a fixed limit
35+
rs staged
36+
rs staged --concurrent true
37+
38+
# Run one task at a time
3239
rs staged --concurrent false
40+
41+
# Run at most four tasks at a time
42+
rs staged --concurrent 4
43+
44+
# -p is shorthand for --concurrent
45+
rs staged -p 4
46+
```
47+
48+
For example:
49+
50+
```ts
51+
define.staged({
52+
'*.ts': ['rs lint --fix', 'rs fmt'],
53+
'*.md': 'rs fmt',
54+
});
3355
```
3456

57+
With concurrency enabled, `rs fmt` for Markdown files may run while TypeScript files are being linted. For TypeScript files, `rs fmt` starts only after `rs lint --fix` finishes.
58+
3559
### `--cwd`
3660

3761
`--cwd` sets the working directory used to run all tasks.

website/docs/zh/guide/cli/staged.mdx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,36 @@ rs staged --allow-empty
2626

2727
### `--concurrent`
2828

29-
`--concurrent`(或 `-p`)用于设置并发运行的任务数量;设为 `false` 时串行运行。
29+
`--concurrent` 用于控制同时运行的任务数量,可设置为 `true``false` 或正整数。
30+
31+
省略该选项时,默认值为 `true``rs staged` 会并发运行任务且不设置固定的并发上限。设为 `false` 时会逐个运行任务;设为正整数时,会限制同时运行的任务数量。
3032

3133
```bash
34+
# 使用默认行为:并发运行任务,不设置固定的并发上限
35+
rs staged
36+
rs staged --concurrent true
37+
38+
# 每次运行一个任务
3239
rs staged --concurrent false
40+
41+
# 最多同时运行四个任务
42+
rs staged --concurrent 4
43+
44+
# -p 是 --concurrent 的缩写
45+
rs staged -p 4
46+
```
47+
48+
例如:
49+
50+
```ts
51+
define.staged({
52+
'*.ts': ['rs lint --fix', 'rs fmt'],
53+
'*.md': 'rs fmt',
54+
});
3355
```
3456

57+
启用并发时,Markdown 文件的 `rs fmt` 可以在 TypeScript 文件执行 `rs lint --fix` 的同时运行;对于 TypeScript 文件,只有 `rs lint --fix` 完成后才会运行 `rs fmt`
58+
3559
### `--cwd`
3660

3761
`--cwd` 用于设置运行所有任务时使用的工作目录。

0 commit comments

Comments
 (0)