1
1
mirror of https://github.com/casey/just.git synced 2024-11-23 02:44:56 +03:00

Add version to attributes (#1694)

This commit is contained in:
Joey Teng 2023-10-11 20:56:35 +01:00 committed by GitHub
parent 22e103361f
commit 0c6484f3a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 21 deletions

View File

@ -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:
@ -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
@ -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

View File

@ -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]` 属性是配置属性。默认情况下,配方总是被启用。一个带有一个或多个配置属性的配方只有在其中一个或多个配置处于激活状态时才会被启用。
@ -2050,7 +2052,7 @@ echo 'Bar!'
Bar!
```
`just` 在配方行失败时通常会打印错误信息,这些错误信息可以通过 `[no-exit-message]` 属性来抑制。你可能会发现这在包装工具的配方中特别有用:
`just` 在配方行失败时通常会打印错误信息,这些错误信息可以通过 `[no-exit-message]`<sup>1.7.0</sup> 属性来抑制。你可能会发现这在包装工具的配方中特别有用:
```just
git *args: