mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 02:42:47 +08:00
[cargo] Use filesystem for --example completions
`cargo run --example` no longer lists examples and never listed examples that were not built.
This commit is contained in:
parent
cf075b4179
commit
0d3f4db33a
|
@ -31,9 +31,17 @@ for x in bench build rustc test
|
||||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l test -a "(cargo test --test 2>&1 | string replace -rf '^\s+' '')"
|
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l test -a "(cargo test --test 2>&1 | string replace -rf '^\s+' '')"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function __list_cargo_examples
|
||||||
|
if not test -d ./examples
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
find ./examples/ -mindepth 1 -maxdepth 1 -type f -name "*.rs" -or -type d \
|
||||||
|
| string replace -r './examples/(.*)(?:.rs)?$' '$1'
|
||||||
|
end
|
||||||
for x in bench build run rustc test
|
for x in bench build run rustc test
|
||||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bin -a "(cargo run --bin 2>&1 | string replace -rf '^\s+' '')"
|
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bin -a "(cargo run --bin 2>&1 | string replace -rf '^\s+' '')"
|
||||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l example -a "(cargo run --example 2>&1 | string replace -rf '^\s+' '')"
|
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l example -a "(__list_cargo_examples)"
|
||||||
end
|
end
|
||||||
|
|
||||||
for x in build run rustc test
|
for x in build run rustc test
|
||||||
|
|
Loading…
Reference in New Issue
Block a user