Skip to content

Commit

Permalink
Merge branch 'master' into load-from-stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
drzymalanet authored Jun 25, 2024
2 parents b8a86a4 + 570d305 commit e4e15ae
Show file tree
Hide file tree
Showing 56 changed files with 1,867 additions and 954 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
shell: bash

- name: Publish Archive
uses: softprops/[email protected].5
uses: softprops/[email protected].6
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
Expand All @@ -105,7 +105,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Changelog
uses: softprops/[email protected].5
uses: softprops/[email protected].6
if: >-
${{
startsWith(github.ref, 'refs/tags/')
Expand Down
955 changes: 492 additions & 463 deletions CHANGELOG.md

Large diffs are not rendered by default.

68 changes: 29 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "just"
version = "1.28.0"
version = "1.29.1"
authors = ["Casey Rodarmor <[email protected]>"]
autotests = false
categories = ["command-line-utilities", "development-tools"]
Expand Down Expand Up @@ -54,7 +54,6 @@ unicode-width = "0.1.0"
uuid = { version = "1.0.0", features = ["v4"] }

[dev-dependencies]
cradle = "0.2.0"
executable-path = "1.0.0"
pretty_assertions = "1.0.0"
temptree = "0.2.0"
Expand Down
69 changes: 62 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ Available recipes:
lint
```

Recipes in submodules can be listed with `just --list PATH`, where `PATH` is a
space- or `::`-separated module path:
Recipes in [submodules](#modules1190) can be listed with `just --list PATH`,
where `PATH` is a space- or `::`-separated module path:

```
$ cat justfile
Expand Down Expand Up @@ -996,6 +996,20 @@ $ just test foo "bar baz"
- bar baz
```

Positional arguments may also be turned on on a per-recipe basis with the
`[positional-arguments]` attribute<sup>1.29.0</sup>:

```just
[positional-arguments]
@foo bar:
echo $0
echo $1
```

Note that PowerShell does not handle positional arguments in the same way as
other shells, so turning on positional arguments will likely break recipes that
use PowerShell.

#### Shell

The `shell` setting controls the command used to invoke recipe lines and
Expand Down Expand Up @@ -1300,6 +1314,7 @@ foobar := x'~/$FOO/${BAR}'
|------|-------------|
| `$VAR` | value of environment variable `VAR` |
| `${VAR}` | value of environment variable `VAR` |
| `${VAR:-DEFAULT}` | value of environment variable `VAR`, or `DEFAULT` if `VAR` is not set |
| Leading `~` | path to current user's home directory |
| Leading `~USER` | path to `USER`'s home directory |

Expand Down Expand Up @@ -1627,6 +1642,16 @@ which will halt execution.
characters. For example, `choose('64', HEX)` will generate a random
64-character lowercase hex string.

#### Datetime

- `datetime(format)`<sup>master</sup> - Return local time with `format`.
- `datetime_utc(format)`<sup>master</sup> - Return UTC time with `format`.

The arguments to `datetime` and `datetime_utc` are `strftime`-style format
strings, see the
[`chrono` library docs](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
for details.

#### Semantic Versions

- `semver_matches(version, requirement)`<sup>1.16.0</sup> - Check whether a
Expand Down Expand Up @@ -1686,6 +1711,7 @@ Recipes may be annotated with attributes that change their behavior.
| `[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. |
| `[no-quiet]`<sup>1.23.0</sup> | Override globally quiet recipes and always echo out the recipe. |
| `[positional-arguments]`<sup>1.29.0</sup> | Turn on [positional arguments](#positional-arguments) for this recipe. |
| `[private]`<sup>1.10.0</sup> | See [Private Recipes](#private-recipes). |
| `[unix]`<sup>1.8.0</sup> | Enable recipe on Unixes. (Includes MacOS). |
| `[windows]`<sup>1.8.0</sup> | Enable recipe on Windows. |
Expand Down Expand Up @@ -1845,6 +1871,8 @@ Recipe groups:
rust recipes
```

Use `just --groups --unsorted` to print groups in their justfile order.

### Command Evaluation Using Backticks

Backticks can be used to store the result of commands:
Expand Down Expand Up @@ -2059,7 +2087,7 @@ a $A $B=`echo $A`:
When [export](#export) is set, all `just` variables are exported as environment
variables.

#### Unexporting Environment Variables<sup>master</sup>
#### Unexporting Environment Variables<sup>1.29.0</sup>

Environment variables can be unexported with the `unexport keyword`:

Expand Down Expand Up @@ -3117,7 +3145,7 @@ import? 'foo/bar.just'

Missing source files for optional imports do not produce an error.

### Modules <sup>1.19.0</sup>
### Modules<sup>1.19.0</sup>

A `justfile` can declare modules using `mod` statements. `mod` statements are
currently unstable, so you'll need to use the `--unstable` flag, or set the
Expand Down Expand Up @@ -3362,9 +3390,9 @@ foo argument:
touch "$1"
```

This defeats `just`'s ability to catch typos, for example if you type `$2`, but
works for all possible values of `argument`, including those with double
quotes.
This defeats `just`'s ability to catch typos, for example if you type `$2`
instead of `$1`, but works for all possible values of `argument`, including
those with double quotes.

#### Exported Arguments

Expand Down Expand Up @@ -3629,6 +3657,33 @@ Node.js `package.json` files:
export PATH := "./node_modules/.bin:" + env_var('PATH')
```

### Paths on Windows

On Windows, functions that return paths will return `\`-separated paths. When
not using PowerShell or `cmd.exe` these paths should be quoted to prevent the
`\`s from being intepreted as character escapes:

```just
ls:
echo '{{absolute_path(".")}}'
```

### Remote Justfiles

If you wish to include a `mod` or `import` source file in many `justfiles`
without needing to duplicate it, you can use an optional `mod` or `import`,
along with a recipe to fetch the module source:

```just
import? 'foo.just'
fetch:
curl https://raw.githubusercontent.com/casey/just/master/justfile > foo.just
```

Given the above `justfile`, after running `just fetch`, the recipes in
`foo.just` will be available.

### Alternatives and Prior Art

There is no shortage of command runners! Some more or less similar alternatives
Expand Down
10 changes: 3 additions & 7 deletions crates/update-contributors/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ fn main() {
.replace_all(
&fs::read_to_string("CHANGELOG.md").unwrap(),
|captures: &Captures| {
let pr = captures[1].parse().unwrap();
match author(pr).as_str() {
"casey" => format!("([#{pr}](https://github.com/casey/just/pull/{pr}))"),
contributor => {
format!("([#{pr}](https://github.com/casey/just/pull/{pr}) by [{contributor}](https://github.com/{contributor}))")
}
}
let pr = captures[1].parse().unwrap();
let contributor = author(pr);
format!("([#{pr}](https://github.com/casey/just/pull/{pr}) by [{contributor}](https://github.com/{contributor}))")
},
),
)
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<'src> Analyzer<'src> {
}
}

let recipes = RecipeResolver::resolve_recipes(recipe_table, &self.assignments)?;
let recipes = RecipeResolver::resolve_recipes(&self.assignments, &settings, recipe_table)?;

let mut aliases = Table::new();
while let Some(alias) = self.aliases.pop() {
Expand Down
Loading

0 comments on commit e4e15ae

Please sign in to comment.