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/rustup/rustup.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/rustup/rustup.plugin.zsh (limited to 'plugins/rustup/rustup.plugin.zsh') diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh new file mode 100644 index 000000000..c7a9b3060 --- /dev/null +++ b/plugins/rustup/rustup.plugin.zsh @@ -0,0 +1,12 @@ +# COMPLETION FUNCTION +if (( $+commands[rustup] )); then + if [[ ! -f $ZSH_CACHE_DIR/rustup_version ]] \ + || [[ "$(rustup --version 2> /dev/null)" \ + != "$(< "$ZSH_CACHE_DIR/rustup_version")" ]] \ + || [[ ! -f $ZSH/plugins/rustup/_rustup ]]; then + rustup completions zsh > $ZSH/plugins/rustup/_rustup + rustup --version 2> /dev/null > $ZSH_CACHE_DIR/rustup_version + fi + autoload -Uz _rustup + _comps[rustup]=_rustup +fi -- cgit v1.2.3-70-g09d2