mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Prevent error output on invocation of rustc completions
fish was indiscriminately calling `rustc -Z help` in the autocompletion script for `rustc`, but `-Z` (and its `-Z help` output completions) is only available when using the nightly compiler. Note that this isn't a perfect fix since if you try to use those command line options now added to the autocompletions list without using the nightly toolchain, `rustc` will still throw an error. But at least this way we don't cause random errors about `-Z` not being available to appear any time someone tries to use `rustc` from the fish command prompt.
This commit is contained in:
parent
5196354176
commit
e1c90cac88
1 changed files with 12 additions and 9 deletions
|
@ -36,7 +36,9 @@ for line in $rust_docs
|
||||||
complete -c rustc -x -s C -l codegen -a "$flag" -d "$docs[2]"
|
complete -c rustc -x -s C -l codegen -a "$flag" -d "$docs[2]"
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l rust_docs (rustc -Z help \
|
# rustc -Z is only available with the nightly toolchain, which may not be installed
|
||||||
|
if rustc +nightly >/dev/null 2>&1
|
||||||
|
set -l rust_docs (rustc +nightly -Z help \
|
||||||
| string replace -r -i '(\s+)-Z(.+)--(\s+)([^\n]+)' '$2 $4' \
|
| string replace -r -i '(\s+)-Z(.+)--(\s+)([^\n]+)' '$2 $4' \
|
||||||
| string trim \
|
| string trim \
|
||||||
| string match -r '^.*[^:]$')
|
| string match -r '^.*[^:]$')
|
||||||
|
@ -47,6 +49,7 @@ for line in $rust_docs
|
||||||
$docs[1])
|
$docs[1])
|
||||||
complete -c rustc -x -s Z -a "$flag" -d "$docs[2]"
|
complete -c rustc -x -s Z -a "$flag" -d "$docs[2]"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set -l rust_docs (rustc -W help \
|
set -l rust_docs (rustc -W help \
|
||||||
| string match -r \
|
| string match -r \
|
||||||
|
|
Loading…
Reference in a new issue