Skip to content

Commit bc34b46

Browse files
committed
wrappers: cargo-rel: workaround for rust-lang/cargo#10271 and co.
Wrapper for `cargo --profile=release` with a custom config, to make up for absence of per-profile options (flags, env) in (stable) Cargo.
1 parent 7816a6a commit bc34b46

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

wrappers/cargo-rel

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
cargo=(
4+
cargo
5+
--config "$HOME/.cargo/config-rel.toml"
6+
)
7+
8+
while (( $# )); do
9+
case "$1" in
10+
run|build|check|rustc|install)
11+
cargo+=( "$1" --profile=release )
12+
shift
13+
break ;;
14+
--profile*|--release|--dev)
15+
# if there is a user profile provided, do not ever attempt to
16+
# override it
17+
break ;;
18+
--)
19+
# if we got to -- without seeing the command, append --release
20+
# into the last possible position and bail
21+
cargo+=( --profile=release )
22+
break ;;
23+
*)
24+
cargo+=( "$1" )
25+
shift ;;
26+
esac
27+
done
28+
29+
set -x
30+
exec "${cargo[@]}" "$@"

0 commit comments

Comments
 (0)