Skip to content

Commit 9098bb5

Browse files
author
Angelo Ross
committed
Use rustc as fallback for --target completion
1 parent 2761949 commit 9098bb5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/etc/cargo.bashcomp.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,11 @@ _get_examples(){
250250
}
251251

252252
_get_targets(){
253-
local result=()
254-
local targets=$(rustup target list)
255-
while read line
256-
do
257-
if [[ "$line" =~ default|installed ]]; then
258-
result+=("${line%% *}")
259-
fi
260-
done <<< "$targets"
261-
echo "${result[@]}"
253+
if command -v rustup >/dev/null 2>/dev/null; then
254+
rustup target list --installed
255+
else
256+
rustc --print target-list
257+
fi
262258
}
263259

264260
_toolchains(){

0 commit comments

Comments
 (0)