mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +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,16 +36,19 @@ for line in $rust_docs
|
|||
complete -c rustc -x -s C -l codegen -a "$flag" -d "$docs[2]"
|
||||
end
|
||||
|
||||
set -l rust_docs (rustc -Z help \
|
||||
| string replace -r -i '(\s+)-Z(.+)--(\s+)([^\n]+)' '$2 $4' \
|
||||
| string trim \
|
||||
| string match -r '^.*[^:]$')
|
||||
# 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 trim \
|
||||
| string match -r '^.*[^:]$')
|
||||
|
||||
for line in $rust_docs
|
||||
set docs (string split -m 1 ' ' $line)
|
||||
set flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
||||
$docs[1])
|
||||
complete -c rustc -x -s Z -a "$flag" -d "$docs[2]"
|
||||
for line in $rust_docs
|
||||
set docs (string split -m 1 ' ' $line)
|
||||
set flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
||||
$docs[1])
|
||||
complete -c rustc -x -s Z -a "$flag" -d "$docs[2]"
|
||||
end
|
||||
end
|
||||
|
||||
set -l rust_docs (rustc -W help \
|
||||
|
|
Loading…
Reference in a new issue