Skip to content

Commit

Permalink
feat: remove completions of --keep-going for bench/test
Browse files Browse the repository at this point in the history
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>
```
  • Loading branch information
weihanglo committed Aug 11, 2023
1 parent 5ae529b commit de8b913
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/etc/_cargo
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ _cargo() {
'(--bench --bin --example --lib)--test=[specify test name]:test name'
)

parallel=(
jobs=(
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
'--keep-going[do not abort build on first error]'
)

parallel=(
"${jobs[@]}"
'--keep-going[do not abort build on first build error]'
)

features=(
Expand Down Expand Up @@ -87,7 +91,7 @@ _cargo() {
'*:args:_default'
;;
bench)
_arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
_arguments -s -A "^--" $common $jobs $features $msgfmt $triple $target $manifest \
"${command_scope_spec[@]}" \
'--all-targets[benchmark all targets]' \
"--no-run[compile but don't run]" \
Expand Down Expand Up @@ -297,7 +301,7 @@ _cargo() {
;;

test | t)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
_arguments -s -S $common $jobs $features $msgfmt $triple $target $manifest \
'--test=[test name]: :_cargo_test_names' \
'--no-fail-fast[run all tests regardless of failure]' \
'--no-run[compile but do not run]' \
Expand Down
7 changes: 4 additions & 3 deletions src/etc/cargo.bashcomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ _cargo()
local opt_pkg='-p --package'
local opt_feat='-F --features --all-features --no-default-features'
local opt_mani='--manifest-path'
local opt_parallel='-j --jobs --keep-going'
local opt_jobs='-j --jobs'
local opt_parallel="$opt_jobs --keep-going"
local opt_force='-f --force'
local opt_sync='-s --sync'
local opt_lock='--frozen --locked --offline'
local opt_targets="--lib --bin --bins --example --examples --test --tests --bench --benches --all-targets"

local opt___nocmd="$opt_common -V --version --list --explain"
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"
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"
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"
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"
local opt__b="$opt__build"
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"
Expand Down Expand Up @@ -82,7 +83,7 @@ _cargo()
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"
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"
local opt__search="$opt_common $opt_lock --limit --index --registry"
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"
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"
local opt__t="$opt__test"
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"
local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"
Expand Down

0 comments on commit de8b913

Please sign in to comment.