Description
The [alias]
configuration is very useful.
It would be even more useful if there was a way to not only define aliases for cargo
, but to run arbitrary scripts.
It's a shame that alias
doesn't allow this already.
I'm therefore proposing to add a new feature: script
s.
I'm imagining something like how npm works, where you can define arbitrary scripts in package.json
that can be executed with npm NAME
or npm run NAME
(for conflicts).
This is very widely used in the JS ecosystem and a great convenience utility.
It would allow a unified way to execute project-related convenience scripts, etc.
EG:
.cargo/config:
[script]
generate-keys = "ssh-keygen ....."
check = "cargo fmt && cargo test && cargo clippy"
deploy = "./bin/deploy.sh"
# Conflicting name, see below
publish = "./bin/publish.sh"
...
Disambiguation could be enabled by the cargo script
command, eg : cargo script publish && cargo deploy
.
Scripts would have the lowest priority, after built in commands, aliases and external binaries.
I'd prefer them to have higher priority than global aliases and extension binaries, but that would be backwards incompatible.