Skip to content

Commit de8b913

Browse files
committed
feat: remove completions of --keep-going for bench/test
To test, simply run: zsh ```zsh fpath+=$PWD/src/etc autoload -Uz compinit compinit cargo t <tab> ``` bash: ```bash . ./src/etc/cargo.bashcomp.sh cargo t <tab> ```
1 parent 5ae529b commit de8b913

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/etc/_cargo

+8-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ _cargo() {
4545
'(--bench --bin --example --lib)--test=[specify test name]:test name'
4646
)
4747

48-
parallel=(
48+
jobs=(
4949
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
50-
'--keep-going[do not abort build on first error]'
50+
)
51+
52+
parallel=(
53+
"${jobs[@]}"
54+
'--keep-going[do not abort build on first build error]'
5155
)
5256

5357
features=(
@@ -87,7 +91,7 @@ _cargo() {
8791
'*:args:_default'
8892
;;
8993
bench)
90-
_arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
94+
_arguments -s -A "^--" $common $jobs $features $msgfmt $triple $target $manifest \
9195
"${command_scope_spec[@]}" \
9296
'--all-targets[benchmark all targets]' \
9397
"--no-run[compile but don't run]" \
@@ -297,7 +301,7 @@ _cargo() {
297301
;;
298302

299303
test | t)
300-
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
304+
_arguments -s -S $common $jobs $features $msgfmt $triple $target $manifest \
301305
'--test=[test name]: :_cargo_test_names' \
302306
'--no-fail-fast[run all tests regardless of failure]' \
303307
'--no-run[compile but do not run]' \

src/etc/cargo.bashcomp.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ _cargo()
4141
local opt_pkg='-p --package'
4242
local opt_feat='-F --features --all-features --no-default-features'
4343
local opt_mani='--manifest-path'
44-
local opt_parallel='-j --jobs --keep-going'
44+
local opt_jobs='-j --jobs'
45+
local opt_parallel="$opt_jobs --keep-going"
4546
local opt_force='-f --force'
4647
local opt_sync='-s --sync'
4748
local opt_lock='--frozen --locked --offline'
4849
local opt_targets="--lib --bin --bins --example --examples --test --tests --bench --benches --all-targets"
4950

5051
local opt___nocmd="$opt_common -V --version --list --explain"
5152
local opt__add="$opt_common -p --package --features --default-features --no-default-features $opt_mani --optional --no-optional --rename --dry-run --path --git --branch --tag --rev --registry --dev --build --target"
52-
local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --no-run --no-fail-fast --target-dir --ignore-rust-version"
53+
local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --no-run --no-fail-fast --target-dir --ignore-rust-version"
5354
local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version"
5455
local opt__b="$opt__build"
5556
local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version"
@@ -82,7 +83,7 @@ _cargo()
8283
local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir --ignore-rust-version"
8384
local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --open --target-dir --profile --ignore-rust-version"
8485
local opt__search="$opt_common $opt_lock --limit --index --registry"
85-
local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile --ignore-rust-version"
86+
local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile --ignore-rust-version"
8687
local opt__t="$opt__test"
8788
local opt__tree="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock --target -i --invert --prefix --no-dedupe --duplicates -d --charset -f --format -e --edges"
8889
local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"

0 commit comments

Comments
 (0)