From 450acc0113b114352ce3b94870fe63fc461844bd Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Tue, 7 Sep 2021 20:02:20 +0200 Subject: fix: automatically create completion for `cargo` and `rustup` plugins (#10087) --- plugins/cargo/cargo.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/cargo/cargo.plugin.zsh (limited to 'plugins/cargo/cargo.plugin.zsh') diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh new file mode 100644 index 000000000..92eae5359 --- /dev/null +++ b/plugins/cargo/cargo.plugin.zsh @@ -0,0 +1,11 @@ +# COMPLETION FUNCTION +if (( $+commands[rustup] && $+commands[cargo] )); then + if [[ ! -f $ZSH_CACHE_DIR/cargo_version ]] \ + || [[ "$(cargo --version)" != "$(< "$ZSH_CACHE_DIR/cargo_version")" ]] \ + || [[ ! -f $ZSH/plugins/cargo/_cargo ]]; then + rustup completions zsh cargo > $ZSH/plugins/cargo/_cargo + cargo --version > $ZSH_CACHE_DIR/cargo_version + fi + autoload -Uz _cargo + _comps[cargo]=_cargo +fi -- cgit v1.2.3-70-g09d2