Skip to content

Commit

Permalink
Use rustc as fallback for --target completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelin01 committed Aug 31, 2023
1 parent 2761949 commit 9098bb5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/etc/cargo.bashcomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,11 @@ _get_examples(){
}

_get_targets(){
local result=()
local targets=$(rustup target list)
while read line
do
if [[ "$line" =~ default|installed ]]; then
result+=("${line%% *}")
fi
done <<< "$targets"
echo "${result[@]}"
if command -v rustup >/dev/null 2>/dev/null; then
rustup target list --installed
else
rustc --print target-list
fi
}

_toolchains(){
Expand Down

0 comments on commit 9098bb5

Please sign in to comment.