Skip to content

Commit

Permalink
Add version to attributes (#1694)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyTeng authored Oct 11, 2023
1 parent 22e1033 commit 0c6484f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1241,15 +1241,15 @@ These functions can fail, for example if a path does not have an extension, whic

Recipes may be annotated with attributes that change their behavior.

| Name | Description |
| ------------------- | ----------------------------------------------- |
| `[no-cd]` | Don't change directory before executing recipe. |
| `[no-exit-message]` | Don't print an error message if recipe fails. |
| `[linux]` | Enable recipe on Linux. |
| `[macos]` | Enable recipe on MacOS. |
| `[unix]` | Enable recipe on Unixes. (Includes MacOS). |
| `[windows]` | Enable recipe on Windows. |
| `[private]` | See [Private Recipes](#private-recipes). |
| Name | Description |
| ----------------------------------- | ----------------------------------------------- |
| `[no-cd]`<sup>1.9.0</sup> | Don't change directory before executing recipe. |
| `[no-exit-message]`<sup>1.7.0</sup> | Don't print an error message if recipe fails. |
| `[linux]`<sup>1.8.0</sup> | Enable recipe on Linux. |
| `[macos]`<sup>1.8.0</sup> | Enable recipe on MacOS. |
| `[unix]`<sup>1.8.0</sup> | Enable recipe on Unixes. (Includes MacOS). |
| `[windows]`<sup>1.8.0</sup> | Enable recipe on Windows. |
| `[private]`<sup>1.10.0</sup> | See [Private Recipes](#private-recipes). |

A recipe can have multiple attributes, either on multiple lines:

Expand All @@ -1268,7 +1268,7 @@ foo:
echo "foo"
```

#### Enabling and Disabling Recipes
#### Enabling and Disabling Recipes<sup>1.8.0</sup>

The `[linux]`, `[macos]`, `[unix]`, and `[windows]` attributes are
configuration attributes. By default, recipes are always enabled. A recipe with
Expand Down Expand Up @@ -2168,7 +2168,7 @@ Bar!
```

`just` normally prints error messages when a recipe line fails. These error
messages can be suppressed using the `[no-exit-message]` attribute. You may find
messages can be suppressed using the `[no-exit-message]`<sup>1.7.0</sup> attribute. You may find
this especially useful with a recipe that recipe wraps a tool:

```just
Expand Down
22 changes: 12 additions & 10 deletions README.中文.md
Original file line number Diff line number Diff line change
Expand Up @@ -1201,16 +1201,18 @@ The executable is at: /bin/just

配方可以通过添加属性注释来改变其行为。

| 名称 | 描述 |
| ------------------- | -------------------------------------- |
| `[no-cd]` | 在执行配方之前不要改变目录。 |
| `[no-exit-message]` | 如果配方执行失败,不要打印错误信息。 |
| `[linux]` | 在Linux上启用配方。 |
| `[macos]` | 在MacOS上启用配方。 |
| `[unix]` | 在Unixes上启用配方。 |
| `[windows]` | 在Windows上启用配方。 |

#### 启用和禁用配方
| 名称 | 描述 |
| ----------------------------------- | -------------------------------------- |
| `[no-cd]`<sup>1.9.0</sup> | 在执行配方之前不要改变目录。 |
| `[no-exit-message]`<sup>1.7.0</sup> | 如果配方执行失败,不要打印错误信息。 |
| `[linux]`<sup>1.8.0</sup> | 在Linux上启用配方。 |
| `[macos]`<sup>1.8.0</sup> | 在MacOS上启用配方。 |
| `[unix]`<sup>1.8.0</sup> | 在Unixes上启用配方。 |
| `[windows]`<sup>1.8.0</sup> | 在Windows上启用配方。 |
| `[private]`<sup>1.10.0</sup> | 参见 [私有配方](#私有配方). |

#### 启用和禁用配方<sup>1.8.0</sup>

`[linux]`, `[macos]`, `[unix]``[windows]` 属性是配置属性。默认情况下,配方总是被启用。一个带有一个或多个配置属性的配方只有在其中一个或多个配置处于激活状态时才会被启用。

Expand Down Expand Up @@ -2050,7 +2052,7 @@ echo 'Bar!'
Bar!
```

`just` 在配方行失败时通常会打印错误信息,这些错误信息可以通过 `[no-exit-message]` 属性来抑制。你可能会发现这在包装工具的配方中特别有用:
`just` 在配方行失败时通常会打印错误信息,这些错误信息可以通过 `[no-exit-message]`<sup>1.7.0</sup> 属性来抑制。你可能会发现这在包装工具的配方中特别有用:

```just
git *args:
Expand Down

0 comments on commit 0c6484f

Please sign in to comment.