Compare commits
No commits in common. "393dbabc9b0e8bef724a0b3d6065c5198af53a04" and "8d3d88fc130d7cab5d7e680e6be0640b01677ec8" have entirely different histories.
393dbabc9b
...
8d3d88fc13
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@ -73,15 +73,13 @@ jobs:
|
|||||||
id: ref-type
|
id: ref-type
|
||||||
run: cargo run --package ref-type -- --reference ${{ github.ref }} >> $GITHUB_OUTPUT
|
run: cargo run --package ref-type -- --reference ${{ github.ref }} >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Generate Completion Scripts and Manpage
|
- name: Generate Completion Scripts
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
cargo build
|
cargo build
|
||||||
for shell in bash elvish fish powershell zsh; do
|
for shell in bash elvish fish powershell zsh; do
|
||||||
./target/debug/just --completions $shell > completions/just.$shell
|
./target/debug/just --completions $shell > completions/just.$shell
|
||||||
done
|
done
|
||||||
mkdir -p man
|
|
||||||
./target/debug/just --man > man/just.1
|
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
id: package
|
id: package
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,7 +10,6 @@
|
|||||||
/fuzz/artifacts
|
/fuzz/artifacts
|
||||||
/fuzz/corpus
|
/fuzz/corpus
|
||||||
/fuzz/target
|
/fuzz/target
|
||||||
/man
|
|
||||||
/target
|
/target
|
||||||
/test-utilities/Cargo.lock
|
/test-utilities/Cargo.lock
|
||||||
/test-utilities/target
|
/test-utilities/target
|
||||||
|
34
CHANGELOG.md
34
CHANGELOG.md
@ -1,40 +1,6 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
[1.28.0](https://github.com/casey/just/releases/tag/1.28.0) - 2024-06-05
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- Write shebang recipes to $XDG_RUNTIME_DIR ([#2128](https://github.com/casey/just/pull/2128))
|
|
||||||
- Add `set dotenv-required` to require an environment file ([#2116](https://github.com/casey/just/pull/2116))
|
|
||||||
- Don't display submodule recipes in `--list` ([#2112](https://github.com/casey/just/pull/2112))
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- Allow listing recipes in submodules with `--list-submodules` ([#2113](https://github.com/casey/just/pull/2113))
|
|
||||||
- Show recipes in submodules with `--show RECIPE::PATH` ([#2111](https://github.com/casey/just/pull/2111))
|
|
||||||
- Add `--timestamp-format` ([#2106](https://github.com/casey/just/pull/2106) by [neunenak](https://github.com/neunenak))
|
|
||||||
- Allow listing submodule recipes with `--list PATH` ([#2108](https://github.com/casey/just/pull/2108))
|
|
||||||
- Print recipe command timestamps with `--timestamps` ([#2084](https://github.com/casey/just/pull/2084) by [neunenak](https://github.com/neunenak))
|
|
||||||
- Add `module_file()` and `module_directory()` functions ([#2105](https://github.com/casey/just/pull/2105))
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Use space-separated recipe paths in `--choose` ([#2115](https://github.com/casey/just/pull/2115))
|
|
||||||
- Fix bash completion for aliases ([#2104](https://github.com/casey/just/pull/2104) by [laniakea64](https://github.com/laniakea64))
|
|
||||||
|
|
||||||
### Misc
|
|
||||||
- Don't check in manpage ([#2130](https://github.com/casey/just/pull/2130))
|
|
||||||
- Document default shell ([#2129](https://github.com/casey/just/pull/2129))
|
|
||||||
- Remove duplicate section in Chinese readme ([#2127](https://github.com/casey/just/pull/2127) by [potterxu](https://github.com/potterxu))
|
|
||||||
- Update Chinese readme ([#2124](https://github.com/casey/just/pull/2124) by [potterxu](https://github.com/potterxu))
|
|
||||||
- Fix typo in readme ([#2122](https://github.com/casey/just/pull/2122) by [potterxu](https://github.com/potterxu))
|
|
||||||
- Don't check in auto-generated completion scripts ([#2120](https://github.com/casey/just/pull/2120))
|
|
||||||
- Document when dependencies run in readme ([#2103](https://github.com/casey/just/pull/2103))
|
|
||||||
- Build aarch64-pc-windows-msvc release binaries ([#2100](https://github.com/casey/just/pull/2100) by [alshdavid](https://github.com/alshdavid))
|
|
||||||
- Clarify that `dotenv-path`-given env file is required ([#2099](https://github.com/casey/just/pull/2099))
|
|
||||||
- Print multi-line doc comments before recipe in `--list` ([#2090](https://github.com/casey/just/pull/2090))
|
|
||||||
- List unsorted imported recipes by import depth and offset ([#2092](https://github.com/casey/just/pull/2092))
|
|
||||||
- Update README.md ([#2091](https://github.com/casey/just/pull/2091) by [laniakea64](https://github.com/laniakea64))
|
|
||||||
|
|
||||||
[1.27.0](https://github.com/casey/just/releases/tag/1.27.0) - 2024-05-25
|
[1.27.0](https://github.com/casey/just/releases/tag/1.27.0) - 2024-05-25
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
38
Cargo.lock
generated
38
Cargo.lock
generated
@ -67,9 +67,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-query"
|
name = "anstyle-query"
|
||||||
version = "1.1.0"
|
version = "1.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
|
checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
@ -505,6 +505,12 @@ dependencies = [
|
|||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@ -587,7 +593,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "just"
|
name = "just"
|
||||||
version = "1.28.0"
|
version = "1.27.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"blake3",
|
"blake3",
|
||||||
@ -776,9 +782,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.85"
|
version = "1.0.83"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
@ -957,18 +963,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.203"
|
version = "1.0.202"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.203"
|
version = "1.0.202"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1084,11 +1090,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strum_macros"
|
name = "strum_macros"
|
||||||
version = "0.26.4"
|
version = "0.26.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.5.0",
|
"heck 0.4.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
@ -1119,9 +1125,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "target"
|
name = "target"
|
||||||
version = "2.1.0"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e8f05f774b2db35bdad5a8237a90be1102669f8ea013fea9777b366d34ab145"
|
checksum = "f4df6b0340c7cc29eb3b955cc588d145ed60651bf1ab939083295d19ec8cc282"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
@ -1218,9 +1224,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.13"
|
version = "0.1.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
|
checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "update-contributors"
|
name = "update-contributors"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "just"
|
name = "just"
|
||||||
version = "1.28.0"
|
version = "1.27.0"
|
||||||
authors = ["Casey Rodarmor <casey@rodarmor.com>"]
|
authors = ["Casey Rodarmor <casey@rodarmor.com>"]
|
||||||
autotests = false
|
autotests = false
|
||||||
categories = ["command-line-utilities", "development-tools"]
|
categories = ["command-line-utilities", "development-tools"]
|
||||||
|
22
README.md
22
README.md
@ -999,7 +999,7 @@ $ just test foo "bar baz"
|
|||||||
#### Shell
|
#### Shell
|
||||||
|
|
||||||
The `shell` setting controls the command used to invoke recipe lines and
|
The `shell` setting controls the command used to invoke recipe lines and
|
||||||
backticks. Shebang recipes are unaffected. The default shell is `sh -cu`.
|
backticks. Shebang recipes are unaffected.
|
||||||
|
|
||||||
```just
|
```just
|
||||||
# use python3 to execute recipe lines and backticks
|
# use python3 to execute recipe lines and backticks
|
||||||
@ -1785,7 +1785,7 @@ js-lint:
|
|||||||
[group('rust recipes')]
|
[group('rust recipes')]
|
||||||
[group('lint')]
|
[group('lint')]
|
||||||
rust-lint:
|
rust-lint:
|
||||||
echo 'Running Rust linter…'
|
echo 'Runninng Rust linter…'
|
||||||
|
|
||||||
[group('lint')]
|
[group('lint')]
|
||||||
cpp-lint:
|
cpp-lint:
|
||||||
@ -2053,23 +2053,6 @@ a $A $B=`echo $A`:
|
|||||||
When [export](#export) is set, all `just` variables are exported as environment
|
When [export](#export) is set, all `just` variables are exported as environment
|
||||||
variables.
|
variables.
|
||||||
|
|
||||||
#### Unexporting Environment Variables<sup>master</sup>
|
|
||||||
|
|
||||||
Environment variables can be unexported with the `unexport keyword`:
|
|
||||||
|
|
||||||
```just
|
|
||||||
unexport FOO
|
|
||||||
|
|
||||||
@foo:
|
|
||||||
echo $FOO
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
$ export FOO=bar
|
|
||||||
$ just foo
|
|
||||||
sh: FOO: unbound variable
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Getting Environment Variables from the environment
|
#### Getting Environment Variables from the environment
|
||||||
|
|
||||||
Environment variables from the environment are passed automatically to the
|
Environment variables from the environment are passed automatically to the
|
||||||
@ -3690,6 +3673,7 @@ Release x.y.z
|
|||||||
- Update changelog
|
- Update changelog
|
||||||
- Update changelog contributor credits
|
- Update changelog contributor credits
|
||||||
- Update dependencies
|
- Update dependencies
|
||||||
|
- Update man page
|
||||||
- Update version references in readme
|
- Update version references in readme
|
||||||
```
|
```
|
||||||
|
|
||||||
|
124
README.中文.md
124
README.中文.md
@ -50,7 +50,7 @@ Yay, all your tests passed!
|
|||||||
|
|
||||||
- 错误会尽可能被静态地解决。未知的配方和循环依赖关系会在运行之前被报告。
|
- 错误会尽可能被静态地解决。未知的配方和循环依赖关系会在运行之前被报告。
|
||||||
|
|
||||||
- `just` 可以 [加载`.env`文件](#环境变量加载),简化环境变量注入。
|
- `just` 可以 [加载`.env`文件](#env-集成),简化环境变量注入。
|
||||||
|
|
||||||
- 配方可以在 [命令行中列出](#列出可用的配方)。
|
- 配方可以在 [命令行中列出](#列出可用的配方)。
|
||||||
|
|
||||||
@ -641,22 +641,18 @@ foo:
|
|||||||
|
|
||||||
#### 设置一览表
|
#### 设置一览表
|
||||||
|
|
||||||
| 名称 | 值 | 默认 | 描述 |
|
| 名称 | 值 | 默认 | 描述 |
|
||||||
| --------------------------- | ------------------ | ----- | --------------------------------------------------------------------------------------- |
|
| ------------------------- | ------------------ | --------|------------------------------------------------------------------------------- |
|
||||||
| `allow-duplicate-recipes` | boolean | False | 允许在 `justfile` 后面出现的配方覆盖之前的同名配方 |
|
| `allow-duplicate-recipes` | boolean | False | 允许在 `justfile` 后面出现的配方覆盖之前的同名配方 |
|
||||||
| `allow-duplicate-variables` | boolean | False | 允许在 `justfile` 后面出现的变量覆盖之前的同名变量 |
|
| `dotenv-load` | boolean | False | 如果有`.env` 环境变量文件的话,则将其加载 |
|
||||||
| `dotenv-filename` | string | - | 如果有自定义名称的 `.env` 环境变量文件的话,则将其加载 |
|
| `export` | boolean | False | 将所有变量导出为环境变量 |
|
||||||
| `dotenv-load` | boolean | False | 如果有`.env` 环境变量文件的话,则将其加载 |
|
| `fallback` | boolean | False | 如果命令行中的第一个配方没有找到,则在父目录中搜索 `justfile` |
|
||||||
| `dotenv-path` | string | - | 从自定义路径中加载 `.env` 环境变量文件, 文件不存在将会报错。可以覆盖 `dotenv-filename` |
|
| `ignore-comments` | boolean | False | 忽略以`#`开头的配方行 |
|
||||||
| `dotenv-required` | boolean | False | 如果 `.env` 环境变量文件不存在的话,需要报错 |
|
| `positional-arguments` | boolean | False | 传递位置参数 |
|
||||||
| `export` | boolean | False | 将所有变量导出为环境变量 |
|
| `shell` | `[COMMAND, ARGS…]` | - | 设置用于调用配方和评估反引号内包裹内容的命令 |
|
||||||
| `fallback` | boolean | False | 如果命令行中的第一个配方没有找到,则在父目录中搜索 `justfile` |
|
| `tempdir` | string | - | 在 `tempdir` 位置创建临时目录,而不是系统默认的临时目录 |
|
||||||
| `ignore-comments` | boolean | False | 忽略以`#`开头的配方行 |
|
| `windows-powershell` | boolean | False | 在 Windows 上使用 PowerShell 作为默认 Shell(废弃,建议使用 `windows-shell`) |
|
||||||
| `positional-arguments` | boolean | False | 传递位置参数 |
|
| `windows-shell` | `[COMMAND, ARGS…]` | - | 设置用于调用配方和评估反引号内包裹内容的命令 |
|
||||||
| `shell` | `[COMMAND, ARGS…]` | - | 设置用于调用配方和评估反引号内包裹内容的命令 |
|
|
||||||
| `tempdir` | string | - | 在 `tempdir` 位置创建临时目录,而不是系统默认的临时目录 |
|
|
||||||
| `windows-powershell` | boolean | False | 在 Windows 上使用 PowerShell 作为默认 Shell(废弃,建议使用 `windows-shell`) |
|
|
||||||
| `windows-shell` | `[COMMAND, ARGS…]` | - | 设置用于调用配方和评估反引号内包裹内容的命令 |
|
|
||||||
|
|
||||||
Bool 类型设置可以写成:
|
Bool 类型设置可以写成:
|
||||||
|
|
||||||
@ -689,69 +685,9 @@ $ just foo
|
|||||||
bar
|
bar
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 允许重复的变量
|
|
||||||
如果 `allow-duplicate-variables` 被设置为 `true`,那么定义多个同名的变量将不会报错。默认为 `false`。
|
|
||||||
|
|
||||||
```just
|
|
||||||
set allow-duplicate-variables
|
|
||||||
|
|
||||||
a := "foo"
|
|
||||||
a := "bar"
|
|
||||||
|
|
||||||
@foo:
|
|
||||||
echo $a
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ just foo
|
|
||||||
bar
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 环境变量加载
|
#### 环境变量加载
|
||||||
|
|
||||||
如果 `dotenv-load`, `dotenv-filename`, `dotenv-path`, or `dotenv-required`
|
如果将 `dotenv-load` 设置为 `true`,并且存在 `.env` 文件,则该环境配置文件将被加载。默认为 `false`。
|
||||||
中任意一项被设置, `just` 会尝试从文件中加载环境变量
|
|
||||||
|
|
||||||
如果设置了 `dotenv-path`, `just` 会在指定的路径下搜索文件,该路径可以是绝对路径,
|
|
||||||
也可以是基于当前工作路径的相对路径
|
|
||||||
|
|
||||||
如果设置了 `dotenv-filename`,`just` 会在指定的相对路径,以及其所有的上层目录中,搜索指定文件
|
|
||||||
|
|
||||||
如果没有设置 `dotenv-filename`,但是设置了 `dotenv-load` 或 `dotenv-required`,
|
|
||||||
`just` 会在当前工作路径,以及其所有的上层目录中,寻找名为 `.env` 的文件。
|
|
||||||
|
|
||||||
`dotenv-filename` 和 `dotenv-path` 很相似,但是 `dotenv-path` 只会检查指定的目录
|
|
||||||
而 `dotenv-filename` 会检查指定目录以及其所有的上层目录。
|
|
||||||
|
|
||||||
如果没有找到环境变量文件也不会报错,除非设置了 `dotenv-required`。
|
|
||||||
|
|
||||||
从文件中加载的变量是环境变量,而非 `just` 变量,所以在配方和反引号中需要必须通过 `$VARIABLE_NAME` 来调用。
|
|
||||||
|
|
||||||
比如,如果你的 `.env` 文件包含以下内容:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# a comment, will be ignored
|
|
||||||
DATABASE_ADDRESS=localhost:6379
|
|
||||||
SERVER_PORT=1337
|
|
||||||
```
|
|
||||||
|
|
||||||
并且你的 `justfile` 包含:
|
|
||||||
|
|
||||||
```just
|
|
||||||
set dotenv-load
|
|
||||||
|
|
||||||
serve:
|
|
||||||
@echo "Starting server with database $DATABASE_ADDRESS on port $SERVER_PORT…"
|
|
||||||
./server --database $DATABASE_ADDRESS --port $SERVER_PORT
|
|
||||||
```
|
|
||||||
|
|
||||||
`just serve` 将会输出:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ just serve
|
|
||||||
Starting server with database localhost:6379 on port 1337…
|
|
||||||
./server --database $DATABASE_ADDRESS --port $SERVER_PORT
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 导出
|
#### 导出
|
||||||
|
|
||||||
@ -917,6 +853,36 @@ Available recipes:
|
|||||||
test # test stuff
|
test # test stuff
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `.env` 集成
|
||||||
|
|
||||||
|
如果 [`dotenv-load`](#环境变量加载) 被设置,`just` 将从一个名为 `.env` 的文件中加载环境变量。这个文件可以和你的 `justfile` 位于同一目录下,或者位于其父目录下。这些变量是环境变量,而不是 `just` 的变量,因此必须使用 `$VARIABLE_NAME` 在配方和反引号中访问。
|
||||||
|
|
||||||
|
例如,假如你的 `.env` 文件包含:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# 注释,将被忽略
|
||||||
|
DATABASE_ADDRESS=localhost:6379
|
||||||
|
SERVER_PORT=1337
|
||||||
|
```
|
||||||
|
|
||||||
|
而你的 `justfile` 包含:
|
||||||
|
|
||||||
|
```just
|
||||||
|
set dotenv-load
|
||||||
|
|
||||||
|
serve:
|
||||||
|
@echo "Starting server with database $DATABASE_ADDRESS on port $SERVER_PORT…"
|
||||||
|
./server --database $DATABASE_ADDRESS --port $SERVER_PORT
|
||||||
|
```
|
||||||
|
|
||||||
|
`just serve` 将会输出:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ just serve
|
||||||
|
Starting server with database localhost:6379 on port 1337…
|
||||||
|
./server --database $DATABASE_ADDRESS --port $SERVER_PORT
|
||||||
|
```
|
||||||
|
|
||||||
### 变量和替换
|
### 变量和替换
|
||||||
|
|
||||||
支持在变量、字符串、拼接、路径连接和替换中使用 `{{…}}` :
|
支持在变量、字符串、拼接、路径连接和替换中使用 `{{…}}` :
|
||||||
@ -1497,7 +1463,7 @@ HOME is '/home/myuser'
|
|||||||
|
|
||||||
#### 从 `.env` 文件加载环境变量
|
#### 从 `.env` 文件加载环境变量
|
||||||
|
|
||||||
如果 [dotenv-load](#环境变量加载) 被设置,`just` 将从 `.env` 文件中加载环境变量。该文件中的变量将作为环境变量提供给配方。参见 [环境变量集成](#环境变量加载) 以获得更多信息。
|
如果 [dotenv-load](#环境变量加载) 被设置,`just` 将从 `.env` 文件中加载环境变量。该文件中的变量将作为环境变量提供给配方。参见 [环境变量集成](#env-集成) 以获得更多信息。
|
||||||
|
|
||||||
#### 从环境变量中设置 `just` 变量
|
#### 从环境变量中设置 `just` 变量
|
||||||
|
|
||||||
|
1
justfile
1
justfile
@ -43,7 +43,6 @@ shellcheck:
|
|||||||
shellcheck www/install.sh
|
shellcheck www/install.sh
|
||||||
|
|
||||||
man:
|
man:
|
||||||
mkdir -p man
|
|
||||||
cargo run -- --man > man/just.1
|
cargo run -- --man > man/just.1
|
||||||
|
|
||||||
view-man: man
|
view-man: man
|
||||||
|
195
man/just.1
Normal file
195
man/just.1
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
.ie \n(.g .ds Aq \(aq
|
||||||
|
.el .ds Aq '
|
||||||
|
.TH just 1 "just 1.27.0"
|
||||||
|
.SH NAME
|
||||||
|
just \- 🤖 Just a command runner \- https://github.com/casey/just
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBjust\fR [\fB\-\-check\fR] [\fB\-\-chooser\fR] [\fB\-\-color\fR] [\fB\-\-command\-color\fR] [\fB\-\-yes\fR] [\fB\-n\fR|\fB\-\-dry\-run\fR] [\fB\-\-dump\-format\fR] [\fB\-\-highlight\fR] [\fB\-\-list\-heading\fR] [\fB\-\-list\-prefix\fR] [\fB\-\-no\-aliases\fR] [\fB\-\-no\-deps\fR] [\fB\-\-no\-dotenv\fR] [\fB\-\-no\-highlight\fR] [\fB\-f\fR|\fB\-\-justfile\fR] [\fB\-q\fR|\fB\-\-quiet\fR] [\fB\-\-set\fR] [\fB\-\-shell\fR] [\fB\-\-shell\-arg\fR] [\fB\-\-shell\-command\fR] [\fB\-\-clear\-shell\-args\fR] [\fB\-u\fR|\fB\-\-unsorted\fR] [\fB\-\-unstable\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-d\fR|\fB\-\-working\-directory\fR] [\fB\-\-changelog\fR] [\fB\-\-choose\fR] [\fB\-c\fR|\fB\-\-command\fR] [\fB\-\-completions\fR] [\fB\-\-dump\fR] [\fB\-e\fR|\fB\-\-edit\fR] [\fB\-\-evaluate\fR] [\fB\-\-fmt\fR] [\fB\-\-init\fR] [\fB\-l\fR|\fB\-\-list\fR] [\fB\-\-groups\fR] [\fB\-\-man\fR] [\fB\-s\fR|\fB\-\-show\fR] [\fB\-\-summary\fR] [\fB\-\-variables\fR] [\fB\-\-dotenv\-filename\fR] [\fB\-E\fR|\fB\-\-dotenv\-path\fR] [\fB\-g\fR|\fB\-\-global\-justfile\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fIARGUMENTS\fR]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
🤖 Just a command runner \- https://github.com/casey/just
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\fB\-\-check\fR
|
||||||
|
Run `\-\-fmt` in \*(Aqcheck\*(Aq mode. Exits with 0 if justfile is formatted correctly. Exits with 1 and prints a diff if formatting is required.
|
||||||
|
.TP
|
||||||
|
\fB\-\-chooser\fR
|
||||||
|
Override binary invoked by `\-\-choose`
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_CHOOSER\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-\-color\fR [default: auto]
|
||||||
|
Print colorful output
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
[\fIpossible values: \fRauto, always, never]
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_COLOR\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-\-command\-color\fR
|
||||||
|
Echo recipe lines in <COMMAND\-COLOR>
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
[\fIpossible values: \fRblack, blue, cyan, green, purple, red, yellow]
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_COMMAND_COLOR\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-\-yes\fR
|
||||||
|
Automatically confirm all recipes.
|
||||||
|
.TP
|
||||||
|
\fB\-n\fR, \fB\-\-dry\-run\fR
|
||||||
|
Print what just would do without doing it
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_DRY_RUN\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-\-dump\-format\fR=\fIFORMAT\fR [default: just]
|
||||||
|
Dump justfile as <FORMAT>
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
[\fIpossible values: \fRjust, json]
|
||||||
|
.TP
|
||||||
|
\fB\-\-highlight\fR
|
||||||
|
Highlight echoed recipe lines in bold
|
||||||
|
.TP
|
||||||
|
\fB\-\-list\-heading\fR=\fITEXT\fR
|
||||||
|
Print <TEXT> before list
|
||||||
|
.TP
|
||||||
|
\fB\-\-list\-prefix\fR=\fITEXT\fR
|
||||||
|
Print <TEXT> before each list item
|
||||||
|
.TP
|
||||||
|
\fB\-\-no\-aliases\fR
|
||||||
|
Don\*(Aqt show aliases in list
|
||||||
|
.TP
|
||||||
|
\fB\-\-no\-deps\fR
|
||||||
|
Don\*(Aqt run recipe dependencies
|
||||||
|
.TP
|
||||||
|
\fB\-\-no\-dotenv\fR
|
||||||
|
Don\*(Aqt load `.env` file
|
||||||
|
.TP
|
||||||
|
\fB\-\-no\-highlight\fR
|
||||||
|
Don\*(Aqt highlight echoed recipe lines in bold
|
||||||
|
.TP
|
||||||
|
\fB\-f\fR, \fB\-\-justfile\fR
|
||||||
|
Use <JUSTFILE> as justfile
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_JUSTFILE\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-q\fR, \fB\-\-quiet\fR
|
||||||
|
Suppress all output
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_QUIET\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-\-set\fR=\fIVARIABLE VALUE\fR
|
||||||
|
Override <VARIABLE> with <VALUE>
|
||||||
|
.TP
|
||||||
|
\fB\-\-shell\fR
|
||||||
|
Invoke <SHELL> to run recipes
|
||||||
|
.TP
|
||||||
|
\fB\-\-shell\-arg\fR
|
||||||
|
Invoke shell with <SHELL\-ARG> as an argument
|
||||||
|
.TP
|
||||||
|
\fB\-\-shell\-command\fR
|
||||||
|
Invoke <COMMAND> with the shell used to run recipe lines and backticks
|
||||||
|
.TP
|
||||||
|
\fB\-\-clear\-shell\-args\fR
|
||||||
|
Clear shell arguments
|
||||||
|
.TP
|
||||||
|
\fB\-u\fR, \fB\-\-unsorted\fR
|
||||||
|
Return list and summary entries in source order
|
||||||
|
.TP
|
||||||
|
\fB\-\-unstable\fR
|
||||||
|
Enable unstable features
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_UNSTABLE\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-v\fR, \fB\-\-verbose\fR
|
||||||
|
Use verbose output
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_VERBOSE\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-d\fR, \fB\-\-working\-directory\fR
|
||||||
|
Use <WORKING\-DIRECTORY> as working directory. \-\-justfile must also be set
|
||||||
|
.RS
|
||||||
|
May also be specified with the \fBJUST_WORKING_DIRECTORY\fR environment variable.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\fB\-\-changelog\fR
|
||||||
|
Print changelog
|
||||||
|
.TP
|
||||||
|
\fB\-\-choose\fR
|
||||||
|
Select one or more recipes to run using a binary chooser. If `\-\-chooser` is not passed the chooser defaults to the value of $JUST_CHOOSER, falling back to `fzf`
|
||||||
|
.TP
|
||||||
|
\fB\-c\fR, \fB\-\-command\fR
|
||||||
|
Run an arbitrary command with the working directory, `.env`, overrides, and exports set
|
||||||
|
.TP
|
||||||
|
\fB\-\-completions\fR=\fISHELL\fR
|
||||||
|
Print shell completion script for <SHELL>
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
[\fIpossible values: \fRbash, elvish, fish, powershell, zsh]
|
||||||
|
.TP
|
||||||
|
\fB\-\-dump\fR
|
||||||
|
Print justfile
|
||||||
|
.TP
|
||||||
|
\fB\-e\fR, \fB\-\-edit\fR
|
||||||
|
Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`
|
||||||
|
.TP
|
||||||
|
\fB\-\-evaluate\fR
|
||||||
|
Evaluate and print all variables. If a variable name is given as an argument, only print that variable\*(Aqs value.
|
||||||
|
.TP
|
||||||
|
\fB\-\-fmt\fR
|
||||||
|
Format and overwrite justfile
|
||||||
|
.TP
|
||||||
|
\fB\-\-init\fR
|
||||||
|
Initialize new justfile in project root
|
||||||
|
.TP
|
||||||
|
\fB\-l\fR, \fB\-\-list\fR
|
||||||
|
List available recipes and their arguments
|
||||||
|
.TP
|
||||||
|
\fB\-\-groups\fR
|
||||||
|
List recipe groups
|
||||||
|
.TP
|
||||||
|
\fB\-\-man\fR
|
||||||
|
Print man page
|
||||||
|
.TP
|
||||||
|
\fB\-s\fR, \fB\-\-show\fR=\fIRECIPE\fR
|
||||||
|
Show information about <RECIPE>
|
||||||
|
.TP
|
||||||
|
\fB\-\-summary\fR
|
||||||
|
List names of available recipes
|
||||||
|
.TP
|
||||||
|
\fB\-\-variables\fR
|
||||||
|
List names of variables
|
||||||
|
.TP
|
||||||
|
\fB\-\-dotenv\-filename\fR
|
||||||
|
Search for environment file named <DOTENV\-FILENAME> instead of `.env`
|
||||||
|
.TP
|
||||||
|
\fB\-E\fR, \fB\-\-dotenv\-path\fR
|
||||||
|
Load <DOTENV\-PATH> as environment file instead of searching for one
|
||||||
|
.TP
|
||||||
|
\fB\-g\fR, \fB\-\-global\-justfile\fR
|
||||||
|
Use global justfile
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
Print help
|
||||||
|
.TP
|
||||||
|
\fB\-V\fR, \fB\-\-version\fR
|
||||||
|
Print version
|
||||||
|
.TP
|
||||||
|
[\fIARGUMENTS\fR]
|
||||||
|
Overrides and recipe(s) to run, defaulting to the first recipe in the justfile
|
||||||
|
.SH VERSION
|
||||||
|
v1.27.0
|
||||||
|
.SH AUTHORS
|
||||||
|
Casey Rodarmor <casey@rodarmor.com>
|
@ -37,8 +37,6 @@ impl<'src> Analyzer<'src> {
|
|||||||
|
|
||||||
let mut modules: Table<Justfile> = Table::new();
|
let mut modules: Table<Justfile> = Table::new();
|
||||||
|
|
||||||
let mut unexports: HashSet<String> = HashSet::new();
|
|
||||||
|
|
||||||
let mut definitions: HashMap<&str, (&'static str, Name)> = HashMap::new();
|
let mut definitions: HashMap<&str, (&'static str, Name)> = HashMap::new();
|
||||||
|
|
||||||
let mut define = |name: Name<'src>,
|
let mut define = |name: Name<'src>,
|
||||||
@ -100,13 +98,6 @@ impl<'src> Analyzer<'src> {
|
|||||||
self.analyze_set(set)?;
|
self.analyze_set(set)?;
|
||||||
self.sets.insert(set.clone());
|
self.sets.insert(set.clone());
|
||||||
}
|
}
|
||||||
Item::Unexport { name } => {
|
|
||||||
if !unexports.insert(name.lexeme().to_string()) {
|
|
||||||
return Err(name.token.error(DuplicateUnexport {
|
|
||||||
variable: name.lexeme(),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,23 +109,21 @@ impl<'src> Analyzer<'src> {
|
|||||||
let mut recipe_table: Table<'src, UnresolvedRecipe<'src>> = Table::default();
|
let mut recipe_table: Table<'src, UnresolvedRecipe<'src>> = Table::default();
|
||||||
|
|
||||||
for assignment in assignments {
|
for assignment in assignments {
|
||||||
let variable = assignment.name.lexeme();
|
if !settings.allow_duplicate_variables
|
||||||
|
&& self.assignments.contains_key(assignment.name.lexeme())
|
||||||
if !settings.allow_duplicate_variables && self.assignments.contains_key(variable) {
|
{
|
||||||
return Err(assignment.name.token.error(DuplicateVariable { variable }));
|
return Err(assignment.name.token.error(DuplicateVariable {
|
||||||
|
variable: assignment.name.lexeme(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if self
|
if self
|
||||||
.assignments
|
.assignments
|
||||||
.get(variable)
|
.get(assignment.name.lexeme())
|
||||||
.map_or(true, |original| assignment.depth <= original.depth)
|
.map_or(true, |original| assignment.depth <= original.depth)
|
||||||
{
|
{
|
||||||
self.assignments.insert(assignment.clone());
|
self.assignments.insert(assignment.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
if unexports.contains(variable) {
|
|
||||||
return Err(assignment.name.token.error(ExportUnexported { variable }));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AssignmentResolver::resolve_assignments(&self.assignments)?;
|
AssignmentResolver::resolve_assignments(&self.assignments)?;
|
||||||
@ -178,7 +167,6 @@ impl<'src> Analyzer<'src> {
|
|||||||
recipes,
|
recipes,
|
||||||
settings,
|
settings,
|
||||||
source: root.into(),
|
source: root.into(),
|
||||||
unexports,
|
|
||||||
warnings,
|
warnings,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ impl AttributeDiscriminant {
|
|||||||
impl<'src> Attribute<'src> {
|
impl<'src> Attribute<'src> {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
name: Name<'src>,
|
name: Name<'src>,
|
||||||
mut arguments: Vec<StringLiteral<'src>>,
|
argument: Option<StringLiteral<'src>>,
|
||||||
) -> CompileResult<'src, Self> {
|
) -> CompileResult<'src, Self> {
|
||||||
use AttributeDiscriminant::*;
|
use AttributeDiscriminant::*;
|
||||||
|
|
||||||
@ -56,7 +56,8 @@ impl<'src> Attribute<'src> {
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let found = arguments.len();
|
let found = argument.as_ref().iter().count();
|
||||||
|
|
||||||
let range = discriminant.argument_range();
|
let range = discriminant.argument_range();
|
||||||
|
|
||||||
if !range.contains(&found) {
|
if !range.contains(&found) {
|
||||||
@ -71,9 +72,9 @@ impl<'src> Attribute<'src> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(match discriminant {
|
Ok(match discriminant {
|
||||||
Confirm => Self::Confirm(arguments.pop()),
|
Confirm => Self::Confirm(argument),
|
||||||
Doc => Self::Doc(arguments.pop()),
|
Doc => Self::Doc(argument),
|
||||||
Group => Self::Group(arguments.pop().unwrap()),
|
Group => Self::Group(argument.unwrap()),
|
||||||
Linux => Self::Linux,
|
Linux => Self::Linux,
|
||||||
Macos => Self::Macos,
|
Macos => Self::Macos,
|
||||||
NoCd => Self::NoCd,
|
NoCd => Self::NoCd,
|
||||||
|
@ -1,41 +1,25 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub(crate) trait CommandExt {
|
pub(crate) trait CommandExt {
|
||||||
fn export(
|
fn export(&mut self, settings: &Settings, dotenv: &BTreeMap<String, String>, scope: &Scope);
|
||||||
&mut self,
|
|
||||||
settings: &Settings,
|
|
||||||
dotenv: &BTreeMap<String, String>,
|
|
||||||
scope: &Scope,
|
|
||||||
unexports: &HashSet<String>,
|
|
||||||
);
|
|
||||||
|
|
||||||
fn export_scope(&mut self, settings: &Settings, scope: &Scope, unexports: &HashSet<String>);
|
fn export_scope(&mut self, settings: &Settings, scope: &Scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CommandExt for Command {
|
impl CommandExt for Command {
|
||||||
fn export(
|
fn export(&mut self, settings: &Settings, dotenv: &BTreeMap<String, String>, scope: &Scope) {
|
||||||
&mut self,
|
|
||||||
settings: &Settings,
|
|
||||||
dotenv: &BTreeMap<String, String>,
|
|
||||||
scope: &Scope,
|
|
||||||
unexports: &HashSet<String>,
|
|
||||||
) {
|
|
||||||
for (name, value) in dotenv {
|
for (name, value) in dotenv {
|
||||||
self.env(name, value);
|
self.env(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(parent) = scope.parent() {
|
if let Some(parent) = scope.parent() {
|
||||||
self.export_scope(settings, parent, unexports);
|
self.export_scope(settings, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn export_scope(&mut self, settings: &Settings, scope: &Scope, unexports: &HashSet<String>) {
|
fn export_scope(&mut self, settings: &Settings, scope: &Scope) {
|
||||||
if let Some(parent) = scope.parent() {
|
if let Some(parent) = scope.parent() {
|
||||||
self.export_scope(settings, parent, unexports);
|
self.export_scope(settings, parent);
|
||||||
}
|
|
||||||
|
|
||||||
for unexport in unexports {
|
|
||||||
self.env_remove(unexport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for binding in scope.bindings() {
|
for binding in scope.bindings() {
|
||||||
|
@ -131,9 +131,6 @@ impl Display for CompileError<'_> {
|
|||||||
DuplicateVariable { variable } => {
|
DuplicateVariable { variable } => {
|
||||||
write!(f, "Variable `{variable}` has multiple definitions")
|
write!(f, "Variable `{variable}` has multiple definitions")
|
||||||
}
|
}
|
||||||
DuplicateUnexport { variable } => {
|
|
||||||
write!(f, "Variable `{variable}` is unexported multiple times")
|
|
||||||
}
|
|
||||||
ExpectedKeyword { expected, found } => {
|
ExpectedKeyword { expected, found } => {
|
||||||
let expected = List::or_ticked(expected);
|
let expected = List::or_ticked(expected);
|
||||||
if found.kind == TokenKind::Identifier {
|
if found.kind == TokenKind::Identifier {
|
||||||
@ -146,9 +143,6 @@ impl Display for CompileError<'_> {
|
|||||||
write!(f, "Expected keyword {expected} but found `{}`", found.kind)
|
write!(f, "Expected keyword {expected} but found `{}`", found.kind)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExportUnexported { variable } => {
|
|
||||||
write!(f, "Variable {variable} is both exported and unexported")
|
|
||||||
}
|
|
||||||
ExtraLeadingWhitespace => write!(f, "Recipe line has extra leading whitespace"),
|
ExtraLeadingWhitespace => write!(f, "Recipe line has extra leading whitespace"),
|
||||||
FunctionArgumentCountMismatch {
|
FunctionArgumentCountMismatch {
|
||||||
function,
|
function,
|
||||||
|
@ -52,16 +52,10 @@ pub(crate) enum CompileErrorKind<'src> {
|
|||||||
DuplicateVariable {
|
DuplicateVariable {
|
||||||
variable: &'src str,
|
variable: &'src str,
|
||||||
},
|
},
|
||||||
DuplicateUnexport {
|
|
||||||
variable: &'src str,
|
|
||||||
},
|
|
||||||
ExpectedKeyword {
|
ExpectedKeyword {
|
||||||
expected: Vec<Keyword>,
|
expected: Vec<Keyword>,
|
||||||
found: Token<'src>,
|
found: Token<'src>,
|
||||||
},
|
},
|
||||||
ExportUnexported {
|
|
||||||
variable: &'src str,
|
|
||||||
},
|
|
||||||
ExtraLeadingWhitespace,
|
ExtraLeadingWhitespace,
|
||||||
FunctionArgumentCountMismatch {
|
FunctionArgumentCountMismatch {
|
||||||
function: &'src str,
|
function: &'src str,
|
||||||
|
@ -20,7 +20,7 @@ pub(crate) enum Error<'src> {
|
|||||||
token: Token<'src>,
|
token: Token<'src>,
|
||||||
output_error: OutputError,
|
output_error: OutputError,
|
||||||
},
|
},
|
||||||
RuntimeDirIo {
|
CacheDirIo {
|
||||||
io_error: io::Error,
|
io_error: io::Error,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
},
|
},
|
||||||
@ -287,6 +287,9 @@ impl<'src> ColorDisplay for Error<'src> {
|
|||||||
}?,
|
}?,
|
||||||
OutputError::Utf8(utf8_error) => write!(f, "Backtick succeeded but stdout was not utf8: {utf8_error}")?,
|
OutputError::Utf8(utf8_error) => write!(f, "Backtick succeeded but stdout was not utf8: {utf8_error}")?,
|
||||||
}
|
}
|
||||||
|
CacheDirIo { io_error, path } => {
|
||||||
|
write!(f, "I/O error in cache dir `{}`: {io_error}", path.display())?;
|
||||||
|
}
|
||||||
ChooserInvoke { shell_binary, shell_arguments, chooser, io_error} => {
|
ChooserInvoke { shell_binary, shell_arguments, chooser, io_error} => {
|
||||||
let chooser = chooser.to_string_lossy();
|
let chooser = chooser.to_string_lossy();
|
||||||
write!(f, "Chooser `{shell_binary} {shell_arguments} {chooser}` invocation failed: {io_error}")?;
|
write!(f, "Chooser `{shell_binary} {shell_arguments} {chooser}` invocation failed: {io_error}")?;
|
||||||
@ -404,9 +407,6 @@ impl<'src> ColorDisplay for Error<'src> {
|
|||||||
write!(f, "Recipe `{recipe}` was not confirmed")?;
|
write!(f, "Recipe `{recipe}` was not confirmed")?;
|
||||||
}
|
}
|
||||||
RegexCompile { source } => write!(f, "{source}")?,
|
RegexCompile { source } => write!(f, "{source}")?,
|
||||||
RuntimeDirIo { io_error, path } => {
|
|
||||||
write!(f, "I/O error in runtime dir `{}`: {io_error}", path.display())?;
|
|
||||||
}
|
|
||||||
Search { search_error } => Display::fmt(search_error, f)?,
|
Search { search_error } => Display::fmt(search_error, f)?,
|
||||||
Shebang { recipe, command, argument, io_error} => {
|
Shebang { recipe, command, argument, io_error} => {
|
||||||
if let Some(argument) = argument {
|
if let Some(argument) = argument {
|
||||||
|
@ -8,7 +8,6 @@ pub(crate) struct Evaluator<'src: 'run, 'run> {
|
|||||||
pub(crate) scope: Scope<'src, 'run>,
|
pub(crate) scope: Scope<'src, 'run>,
|
||||||
pub(crate) search: &'run Search,
|
pub(crate) search: &'run Search,
|
||||||
pub(crate) settings: &'run Settings<'run>,
|
pub(crate) settings: &'run Settings<'run>,
|
||||||
unsets: &'run HashSet<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'src, 'run> Evaluator<'src, 'run> {
|
impl<'src, 'run> Evaluator<'src, 'run> {
|
||||||
@ -20,7 +19,6 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
scope: Scope<'src, 'run>,
|
scope: Scope<'src, 'run>,
|
||||||
search: &'run Search,
|
search: &'run Search,
|
||||||
settings: &'run Settings<'run>,
|
settings: &'run Settings<'run>,
|
||||||
unsets: &'run HashSet<String>,
|
|
||||||
) -> RunResult<'src, Scope<'src, 'run>> {
|
) -> RunResult<'src, Scope<'src, 'run>> {
|
||||||
let mut evaluator = Self {
|
let mut evaluator = Self {
|
||||||
assignments: Some(assignments),
|
assignments: Some(assignments),
|
||||||
@ -30,7 +28,6 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
scope,
|
scope,
|
||||||
search,
|
search,
|
||||||
settings,
|
settings,
|
||||||
unsets,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for assignment in assignments.values() {
|
for assignment in assignments.values() {
|
||||||
@ -220,7 +217,7 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
cmd.arg(command);
|
cmd.arg(command);
|
||||||
cmd.args(args);
|
cmd.args(args);
|
||||||
cmd.current_dir(&self.search.working_directory);
|
cmd.current_dir(&self.search.working_directory);
|
||||||
cmd.export(self.settings, self.dotenv, &self.scope, self.unsets);
|
cmd.export(self.settings, self.dotenv, &self.scope);
|
||||||
cmd.stdin(Stdio::inherit());
|
cmd.stdin(Stdio::inherit());
|
||||||
cmd.stderr(if self.config.verbosity.quiet() {
|
cmd.stderr(if self.config.verbosity.quiet() {
|
||||||
Stdio::null()
|
Stdio::null()
|
||||||
@ -264,7 +261,6 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
scope: &'run Scope<'src, 'run>,
|
scope: &'run Scope<'src, 'run>,
|
||||||
search: &'run Search,
|
search: &'run Search,
|
||||||
settings: &'run Settings,
|
settings: &'run Settings,
|
||||||
unsets: &'run HashSet<String>,
|
|
||||||
) -> RunResult<'src, (Scope<'src, 'run>, Vec<String>)> {
|
) -> RunResult<'src, (Scope<'src, 'run>, Vec<String>)> {
|
||||||
let mut evaluator = Self {
|
let mut evaluator = Self {
|
||||||
assignments: None,
|
assignments: None,
|
||||||
@ -274,7 +270,6 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
scope: scope.child(),
|
scope: scope.child(),
|
||||||
search,
|
search,
|
||||||
settings,
|
settings,
|
||||||
unsets,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut scope = scope.child();
|
let mut scope = scope.child();
|
||||||
@ -321,7 +316,6 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
scope: &'run Scope<'src, 'run>,
|
scope: &'run Scope<'src, 'run>,
|
||||||
search: &'run Search,
|
search: &'run Search,
|
||||||
settings: &'run Settings,
|
settings: &'run Settings,
|
||||||
unsets: &'run HashSet<String>,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
assignments: None,
|
assignments: None,
|
||||||
@ -331,7 +325,6 @@ impl<'src, 'run> Evaluator<'src, 'run> {
|
|||||||
scope: Scope::child(scope),
|
scope: Scope::child(scope),
|
||||||
search,
|
search,
|
||||||
settings,
|
settings,
|
||||||
unsets,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,6 @@ pub(crate) enum Item<'src> {
|
|||||||
},
|
},
|
||||||
Recipe(UnresolvedRecipe<'src>),
|
Recipe(UnresolvedRecipe<'src>),
|
||||||
Set(Set<'src>),
|
Set(Set<'src>),
|
||||||
Unexport {
|
|
||||||
name: Name<'src>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'src> Display for Item<'src> {
|
impl<'src> Display for Item<'src> {
|
||||||
@ -64,7 +61,6 @@ impl<'src> Display for Item<'src> {
|
|||||||
}
|
}
|
||||||
Self::Recipe(recipe) => write!(f, "{}", recipe.color_display(Color::never())),
|
Self::Recipe(recipe) => write!(f, "{}", recipe.color_display(Color::never())),
|
||||||
Self::Set(set) => write!(f, "{set}"),
|
Self::Set(set) => write!(f, "{set}"),
|
||||||
Self::Unexport { name } => write!(f, "unexport {name}"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ pub(crate) struct Justfile<'src> {
|
|||||||
pub(crate) settings: Settings<'src>,
|
pub(crate) settings: Settings<'src>,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub(crate) source: PathBuf,
|
pub(crate) source: PathBuf,
|
||||||
pub(crate) unexports: HashSet<String>,
|
|
||||||
pub(crate) warnings: Vec<Warning>,
|
pub(crate) warnings: Vec<Warning>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +113,6 @@ impl<'src> Justfile<'src> {
|
|||||||
scope,
|
scope,
|
||||||
search,
|
search,
|
||||||
&self.settings,
|
&self.settings,
|
||||||
&self.unexports,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +163,7 @@ impl<'src> Justfile<'src> {
|
|||||||
|
|
||||||
let scope = scope.child();
|
let scope = scope.child();
|
||||||
|
|
||||||
command.export(&self.settings, &dotenv, &scope, &self.unexports);
|
command.export(&self.settings, &dotenv, &scope);
|
||||||
|
|
||||||
let status = InterruptHandler::guard(|| command.status()).map_err(|io_error| {
|
let status = InterruptHandler::guard(|| command.status()).map_err(|io_error| {
|
||||||
Error::CommandInvoke {
|
Error::CommandInvoke {
|
||||||
@ -288,7 +286,6 @@ impl<'src> Justfile<'src> {
|
|||||||
scope: invocation.scope,
|
scope: invocation.scope,
|
||||||
search,
|
search,
|
||||||
settings: invocation.settings,
|
settings: invocation.settings,
|
||||||
unexports: &self.unexports,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Self::run_recipe(
|
Self::run_recipe(
|
||||||
@ -444,7 +441,6 @@ impl<'src> Justfile<'src> {
|
|||||||
context.scope,
|
context.scope,
|
||||||
search,
|
search,
|
||||||
context.settings,
|
context.settings,
|
||||||
context.unexports,
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let scope = outer.child();
|
let scope = outer.child();
|
||||||
@ -456,7 +452,6 @@ impl<'src> Justfile<'src> {
|
|||||||
&scope,
|
&scope,
|
||||||
search,
|
search,
|
||||||
context.settings,
|
context.settings,
|
||||||
context.unexports,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if !context.config.no_dependencies {
|
if !context.config.no_dependencies {
|
||||||
|
@ -25,7 +25,6 @@ pub(crate) enum Keyword {
|
|||||||
Shell,
|
Shell,
|
||||||
Tempdir,
|
Tempdir,
|
||||||
True,
|
True,
|
||||||
Unexport,
|
|
||||||
WindowsPowershell,
|
WindowsPowershell,
|
||||||
WindowsShell,
|
WindowsShell,
|
||||||
X,
|
X,
|
||||||
|
@ -42,7 +42,7 @@ pub(crate) use {
|
|||||||
std::{
|
std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
cmp,
|
cmp,
|
||||||
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
|
collections::{BTreeMap, BTreeSet, HashMap},
|
||||||
env,
|
env,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
fmt::{self, Debug, Display, Formatter},
|
fmt::{self, Debug, Display, Formatter},
|
||||||
|
@ -54,11 +54,6 @@ impl<'src> Node<'src> for Item<'src> {
|
|||||||
}
|
}
|
||||||
Self::Recipe(recipe) => recipe.tree(),
|
Self::Recipe(recipe) => recipe.tree(),
|
||||||
Self::Set(set) => set.tree(),
|
Self::Set(set) => set.tree(),
|
||||||
Self::Unexport { name } => {
|
|
||||||
let mut unexport = Tree::atom(Keyword::Unexport.lexeme());
|
|
||||||
unexport.push_mut(name.lexeme().replace('-', "_"));
|
|
||||||
unexport
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,11 +340,6 @@ impl<'run, 'src> Parser<'run, 'src> {
|
|||||||
self.presume_keyword(Keyword::Export)?;
|
self.presume_keyword(Keyword::Export)?;
|
||||||
items.push(Item::Assignment(self.parse_assignment(true)?));
|
items.push(Item::Assignment(self.parse_assignment(true)?));
|
||||||
}
|
}
|
||||||
Some(Keyword::Unexport) => {
|
|
||||||
self.presume_keyword(Keyword::Unexport)?;
|
|
||||||
let name = self.parse_name()?;
|
|
||||||
items.push(Item::Unexport { name });
|
|
||||||
}
|
|
||||||
Some(Keyword::Import)
|
Some(Keyword::Import)
|
||||||
if self.next_are(&[Identifier, StringToken])
|
if self.next_are(&[Identifier, StringToken])
|
||||||
|| self.next_are(&[Identifier, Identifier, StringToken])
|
|| self.next_are(&[Identifier, Identifier, StringToken])
|
||||||
@ -987,29 +982,15 @@ impl<'run, 'src> Parser<'run, 'src> {
|
|||||||
loop {
|
loop {
|
||||||
let name = self.parse_name()?;
|
let name = self.parse_name()?;
|
||||||
|
|
||||||
let arguments: Vec<StringLiteral> = if self.next_is(Colon) {
|
let argument = if self.accepted(ParenL)? {
|
||||||
self.presume(Colon)?;
|
let argument = self.parse_string_literal()?;
|
||||||
let single_arg = self.parse_string_literal()?;
|
self.expect(ParenR)?;
|
||||||
vec![single_arg]
|
Some(argument)
|
||||||
} else if self.next_is(ParenL) {
|
|
||||||
self.presume(ParenL)?;
|
|
||||||
let mut args = Vec::new();
|
|
||||||
loop {
|
|
||||||
args.push(self.parse_string_literal()?);
|
|
||||||
if self.next_is(ParenR) {
|
|
||||||
self.presume(ParenR)?;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if self.next_is(Comma) {
|
|
||||||
self.presume(Comma)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args
|
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let attribute = Attribute::new(name, arguments)?;
|
let attribute = Attribute::new(name, argument)?;
|
||||||
|
|
||||||
if let Some(line) = attributes.get(&attribute) {
|
if let Some(line) = attributes.get(&attribute) {
|
||||||
return Err(name.error(CompileErrorKind::DuplicateAttribute {
|
return Err(name.error(CompileErrorKind::DuplicateAttribute {
|
||||||
@ -1172,18 +1153,6 @@ mod tests {
|
|||||||
tree: (justfile (alias t test)),
|
tree: (justfile (alias t test)),
|
||||||
}
|
}
|
||||||
|
|
||||||
test! {
|
|
||||||
name: single_argument_attribute_shorthand,
|
|
||||||
text: "[group: 'some-group']\nalias t := test",
|
|
||||||
tree: (justfile (alias t test)),
|
|
||||||
}
|
|
||||||
|
|
||||||
test! {
|
|
||||||
name: single_argument_attribute_shorthand_multiple_same_line,
|
|
||||||
text: "[group: 'some-group', group: 'some-other-group']\nalias t := test",
|
|
||||||
tree: (justfile (alias t test)),
|
|
||||||
}
|
|
||||||
|
|
||||||
test! {
|
test! {
|
||||||
name: aliases_multiple,
|
name: aliases_multiple,
|
||||||
text: "alias t := test\nalias b := build",
|
text: "alias t := test\nalias b := build",
|
||||||
|
@ -169,7 +169,6 @@ impl<'src, D> Recipe<'src, D> {
|
|||||||
scope,
|
scope,
|
||||||
context.search,
|
context.search,
|
||||||
context.settings,
|
context.settings,
|
||||||
context.unexports,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if self.shebang {
|
if self.shebang {
|
||||||
@ -280,7 +279,7 @@ impl<'src, D> Recipe<'src, D> {
|
|||||||
cmd.stdout(Stdio::null());
|
cmd.stdout(Stdio::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.export(context.settings, context.dotenv, scope, context.unexports);
|
cmd.export(context.settings, context.dotenv, scope);
|
||||||
|
|
||||||
match InterruptHandler::guard(|| cmd.status()) {
|
match InterruptHandler::guard(|| cmd.status()) {
|
||||||
Ok(exit_status) => {
|
Ok(exit_status) => {
|
||||||
@ -354,9 +353,9 @@ impl<'src, D> Recipe<'src, D> {
|
|||||||
let tempdir = match &context.settings.tempdir {
|
let tempdir = match &context.settings.tempdir {
|
||||||
Some(tempdir) => tempdir_builder.tempdir_in(context.search.working_directory.join(tempdir)),
|
Some(tempdir) => tempdir_builder.tempdir_in(context.search.working_directory.join(tempdir)),
|
||||||
None => {
|
None => {
|
||||||
if let Some(runtime_dir) = dirs::runtime_dir() {
|
if let Some(cache_dir) = dirs::cache_dir() {
|
||||||
let path = runtime_dir.join("just");
|
let path = cache_dir.join("just");
|
||||||
fs::create_dir_all(&path).map_err(|io_error| Error::RuntimeDirIo {
|
fs::create_dir_all(&path).map_err(|io_error| Error::CacheDirIo {
|
||||||
io_error,
|
io_error,
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
})?;
|
})?;
|
||||||
@ -426,7 +425,7 @@ impl<'src, D> Recipe<'src, D> {
|
|||||||
command.args(positional);
|
command.args(positional);
|
||||||
}
|
}
|
||||||
|
|
||||||
command.export(context.settings, context.dotenv, scope, context.unexports);
|
command.export(context.settings, context.dotenv, scope);
|
||||||
|
|
||||||
// run it!
|
// run it!
|
||||||
match InterruptHandler::guard(|| command.status()) {
|
match InterruptHandler::guard(|| command.status()) {
|
||||||
|
@ -7,5 +7,4 @@ pub(crate) struct RecipeContext<'src: 'run, 'run> {
|
|||||||
pub(crate) scope: &'run Scope<'src, 'run>,
|
pub(crate) scope: &'run Scope<'src, 'run>,
|
||||||
pub(crate) search: &'run Search,
|
pub(crate) search: &'run Search,
|
||||||
pub(crate) settings: &'run Settings<'src>,
|
pub(crate) settings: &'run Settings<'src>,
|
||||||
pub(crate) unexports: &'run HashSet<String>,
|
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ fn multiple_attributes_one_line_error_message() {
|
|||||||
)
|
)
|
||||||
.stderr(
|
.stderr(
|
||||||
"
|
"
|
||||||
error: Expected ']', ':', ',', or '(', but found identifier
|
error: Expected ']', ',', or '(', but found identifier
|
||||||
——▶ justfile:1:17
|
——▶ justfile:1:17
|
||||||
│
|
│
|
||||||
1 │ [macos, windows linux]
|
1 │ [macos, windows linux]
|
||||||
|
@ -29,10 +29,10 @@ fn bash() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn replacements() {
|
fn replacements() {
|
||||||
for shell in ["bash", "elvish", "fish", "powershell", "zsh"] {
|
for shell in ["bash", "elvish", "fish", "powershell", "zsh"] {
|
||||||
let output = Command::new(executable_path("just"))
|
let status = Command::new(executable_path("just"))
|
||||||
.args(["--completions", shell])
|
.args(["--completions", shell])
|
||||||
.output()
|
.status()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(output.status.success());
|
assert!(status.success());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ fn confirm_recipe_with_prompt_too_many_args() {
|
|||||||
echo confirmed
|
echo confirmed
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.stderr("error: Attribute `confirm` got 2 arguments but takes at most 1 argument\n ——▶ justfile:1:2\n │\n1 │ [confirm(\"This is dangerous - are you sure you want to run it?\",\"this second argument is not supported\")]\n │ ^^^^^^^\n")
|
.stderr("error: Expected ')', but found ','\n ——▶ justfile:1:64\n │\n1 │ [confirm(\"This is dangerous - are you sure you want to run it?\",\"this second argument is not supported\")]\n │ ^\n")
|
||||||
.stdout("")
|
.stdout("")
|
||||||
.status(1)
|
.status(1)
|
||||||
.run();
|
.run();
|
||||||
|
@ -126,10 +126,11 @@ fn list_groups_with_custom_prefix() {
|
|||||||
Test::new()
|
Test::new()
|
||||||
.justfile(
|
.justfile(
|
||||||
"
|
"
|
||||||
[group: 'B']
|
[group('B')]
|
||||||
foo:
|
foo:
|
||||||
|
|
||||||
[group: 'A', group: 'B']
|
[group('A')]
|
||||||
|
[group('B')]
|
||||||
bar:
|
bar:
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
@ -59,7 +59,6 @@ fn alias() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -99,7 +98,6 @@ fn assignment() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -153,7 +151,6 @@ fn body() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -219,7 +216,6 @@ fn dependencies() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -323,7 +319,6 @@ fn dependency_argument() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -389,7 +384,6 @@ fn duplicate_recipes() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -433,7 +427,6 @@ fn duplicate_variables() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -480,7 +473,6 @@ fn doc_comment() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -513,7 +505,6 @@ fn empty_justfile() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -667,7 +658,6 @@ fn parameters() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -754,7 +744,6 @@ fn priors() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -801,7 +790,6 @@ fn private() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -848,7 +836,6 @@ fn quiet() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -910,7 +897,6 @@ fn settings() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -960,7 +946,6 @@ fn shebang() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1007,7 +992,6 @@ fn simple() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1057,7 +1041,6 @@ fn attribute() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -1120,7 +1103,6 @@ fn module() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1142,7 +1124,6 @@ fn module() {
|
|||||||
"windows_powershell": false,
|
"windows_powershell": false,
|
||||||
"windows_shell": null,
|
"windows_shell": null,
|
||||||
},
|
},
|
||||||
"unexports": [],
|
|
||||||
"warnings": [],
|
"warnings": [],
|
||||||
}))
|
}))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -104,7 +104,6 @@ mod summary;
|
|||||||
mod tempdir;
|
mod tempdir;
|
||||||
mod timestamps;
|
mod timestamps;
|
||||||
mod undefined_variables;
|
mod undefined_variables;
|
||||||
mod unexport;
|
|
||||||
mod unstable;
|
mod unstable;
|
||||||
#[cfg(target_family = "windows")]
|
#[cfg(target_family = "windows")]
|
||||||
mod windows_shell;
|
mod windows_shell;
|
||||||
|
@ -884,7 +884,7 @@ _private-recipe:
|
|||||||
args: ("--list"),
|
args: ("--list"),
|
||||||
stdout: r#"
|
stdout: r#"
|
||||||
Available recipes:
|
Available recipes:
|
||||||
a Z="\t z" # something else
|
a Z="\t z" # something else
|
||||||
hello a b='B ' c='C' # this does a thing
|
hello a b='B ' c='C' # this does a thing
|
||||||
"#,
|
"#,
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ pub(crate) fn tempdir() -> TempDir {
|
|||||||
|
|
||||||
builder.prefix("just-test-tempdir");
|
builder.prefix("just-test-tempdir");
|
||||||
|
|
||||||
if let Some(runtime_dir) = dirs::runtime_dir() {
|
if let Some(cache_dir) = dirs::cache_dir() {
|
||||||
let path = runtime_dir.join("just");
|
let path = cache_dir.join("just");
|
||||||
fs::create_dir_all(&path).unwrap();
|
fs::create_dir_all(&path).unwrap();
|
||||||
builder.tempdir_in(path)
|
builder.tempdir_in(path)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,104 +0,0 @@
|
|||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn unexport_environment_variable_linewise() {
|
|
||||||
Test::new()
|
|
||||||
.justfile(
|
|
||||||
"
|
|
||||||
unexport JUST_TEST_VARIABLE
|
|
||||||
|
|
||||||
@recipe:
|
|
||||||
echo ${JUST_TEST_VARIABLE:-unset}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.env("JUST_TEST_VARIABLE", "foo")
|
|
||||||
.stdout("unset\n")
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn unexport_environment_variable_shebang() {
|
|
||||||
Test::new()
|
|
||||||
.justfile(
|
|
||||||
"
|
|
||||||
unexport JUST_TEST_VARIABLE
|
|
||||||
|
|
||||||
recipe:
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
echo ${JUST_TEST_VARIABLE:-unset}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.env("JUST_TEST_VARIABLE", "foo")
|
|
||||||
.stdout("unset\n")
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn duplicate_unexport_fails() {
|
|
||||||
Test::new()
|
|
||||||
.justfile(
|
|
||||||
"
|
|
||||||
unexport JUST_TEST_VARIABLE
|
|
||||||
|
|
||||||
recipe:
|
|
||||||
echo \"variable: $JUST_TEST_VARIABLE\"
|
|
||||||
|
|
||||||
unexport JUST_TEST_VARIABLE
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.env("JUST_TEST_VARIABLE", "foo")
|
|
||||||
.stderr(
|
|
||||||
"
|
|
||||||
error: Variable `JUST_TEST_VARIABLE` is unexported multiple times
|
|
||||||
——▶ justfile:6:10
|
|
||||||
│
|
|
||||||
6 │ unexport JUST_TEST_VARIABLE
|
|
||||||
│ ^^^^^^^^^^^^^^^^^^
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.status(1)
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn export_unexport_conflict() {
|
|
||||||
Test::new()
|
|
||||||
.justfile(
|
|
||||||
"
|
|
||||||
unexport JUST_TEST_VARIABLE
|
|
||||||
|
|
||||||
recipe:
|
|
||||||
echo variable: $JUST_TEST_VARIABLE
|
|
||||||
|
|
||||||
export JUST_TEST_VARIABLE := 'foo'
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.stderr(
|
|
||||||
"
|
|
||||||
error: Variable JUST_TEST_VARIABLE is both exported and unexported
|
|
||||||
——▶ justfile:6:8
|
|
||||||
│
|
|
||||||
6 │ export JUST_TEST_VARIABLE := 'foo'
|
|
||||||
│ ^^^^^^^^^^^^^^^^^^
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.status(1)
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn unexport_doesnt_override_local_recipe_export() {
|
|
||||||
Test::new()
|
|
||||||
.justfile(
|
|
||||||
"
|
|
||||||
unexport JUST_TEST_VARIABLE
|
|
||||||
|
|
||||||
recipe $JUST_TEST_VARIABLE:
|
|
||||||
@echo \"variable: $JUST_TEST_VARIABLE\"
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.args(["recipe", "value"])
|
|
||||||
.stdout("variable: value\n")
|
|
||||||
.status(0)
|
|
||||||
.run();
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user