Skip to content

Commit 2f5cbef

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 2f5cbef

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

wrappers/cargo-rel

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
cargo+=( "$1" )
16+
shift
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 "$1" )
22+
shift
23+
break ;;
24+
*)
25+
cargo+=( "$1" )
26+
shift ;;
27+
esac
28+
done
29+
30+
set -x
31+
exec "${cargo[@]}" "$@"

0 commit comments

Comments
 (0)