-
Notifications
You must be signed in to change notification settings - Fork 335
Description
Problem description
I want to get rid of our justfile
and replace it with pixi commands. One thing preventing this is the lack of multiline commands.
Consider this justfile
script:
rs-lint:
cargo cranky --quiet --all-features -- --deny warnings
typos
scripts/lint.py
cargo doc --quiet --no-deps --all-features
cargo doc --quiet --document-private-items --no-deps --all-features
cargo test --quiet --doc --all-features # runs all doc-tests
If I want to translate it into pixi.toml
it will turn into something like:
rs-lint: """
cargo cranky --quiet --all-features -- --deny warnings
&& typos
&& cargo doc --quiet --no-deps --all-features
&& cargo doc --quiet --document-private-items --no-deps --all-features
&& cargo test --quiet --doc --all-features # runs all doc-tests
&& scripts/lint.py
"""
This is okay, but has several shortcomings:
A) its syntax is somewhat ugly
B) it still execute as one big blob
C) it is not obvious to the reader that any extra argument to the script is piped to scripts/lint.py
in this case
Proposal
I suggest that each new line is considered its own command, with an implicit &&
between them:
rs-lint: """
cargo cranky --quiet --all-features -- --deny warnings
typos
cargo doc --quiet --no-deps --all-features
cargo doc --quiet --document-private-items --no-deps --all-features
cargo test --quiet --doc --all-features # runs all doc-tests
scripts/lint.py
"""
Pixi will execute each command in order, and at any failure it would abort (like set -e
in bash).
Moreover, pixi would print each command before executing it (like set -x
in bash).
So the output of could be somethng like:
$ pixi run rs-lint
+ cargo cranky --quiet --all-features -- --deny warnings
+ typos
+ cargo doc --quiet --no-deps --all-features
`src/lib.rs:52`: Error: broken doclink `Foo`
$
Furthermore, I would suggest that the implicit "pass extra arguments to the command" feature would NOT be applied in the multi-command mode.