aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/.zsh/rc/S40_completion31
1 files changed, 20 insertions, 11 deletions
diff --git a/files/.zsh/rc/S40_completion b/files/.zsh/rc/S40_completion
index ffe1036..b812548 100644
--- a/files/.zsh/rc/S40_completion
+++ b/files/.zsh/rc/S40_completion
@@ -47,6 +47,14 @@ compdef _gnu_generic -p 'pg_*'
compdef _command tldr
+__fetch_url() {
+ if command -v curl >/dev/null; then
+ curl -fsSL "$1"
+ elif command -v wget >/dev/null; then
+ wget -q -O- "$1"
+ fi
+}
+
__load_completion_if_exists() {
[[ -f "$1" ]] && source "$1"
}
@@ -64,38 +72,39 @@ __load_or_generate() {
__load_completion_if_exists /etc/bash_completion.d/youtube-dl.bash-completion
__load_completion_if_exists /usr/share/zsh/vendor-completions/_git-extras
-__load_completion_if_exists $LIQUIBASE_HOME/lib/liquibase_autocomplete.zsh
+__load_completion_if_exists "$LIQUIBASE_HOME/lib/liquibase_autocomplete.zsh"
__load_or_generate kubectl "kubectl completion zsh"
__load_or_generate helm "helm completion zsh"
__load_or_generate yq "yq shell-completion zsh"
-__load_or_generate fdfind 'curl -sL "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd"'
+__load_or_generate fdfind '__fetch_url "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd"'
__load_or_generate restic 'restic generate --zsh-completion /dev/stdout'
__load_or_generate docker 'docker completion zsh'
-__load_or_generate docker-compose 'curl -sL "https://raw.githubusercontent.com/docker/compose/1.28.x/contrib/completion/zsh/_docker-compose"'
-__load_or_generate watson 'curl -sL "https://raw.githubusercontent.com/TailorDev/Watson/master/watson.zsh-completion"'
-__load_or_generate cheat 'curl -sL "https://raw.githubusercontent.com/cheat/cheat/master/scripts/cheat.zsh"'
+__load_or_generate docker-compose '__fetch_url "https://raw.githubusercontent.com/docker/compose/1.28.x/contrib/completion/zsh/_docker-compose"'
+__load_or_generate watson '__fetch_url "https://raw.githubusercontent.com/TailorDev/Watson/master/watson.zsh-completion"'
+__load_or_generate cheat '__fetch_url "https://raw.githubusercontent.com/cheat/cheat/master/scripts/cheat.zsh"'
__load_or_generate poetry "poetry completions zsh"
__load_or_generate gmailctl "gmailctl completion zsh"
__load_or_generate bat "bat --completion zsh"
__load_or_generate git-absorb "git-absorb --gen-completions zsh"
-__load_or_generate buku 'curl -sL "https://raw.githubusercontent.com/jarun/buku/refs/heads/master/auto-completion/zsh/_buku"'
+__load_or_generate buku '__fetch_url "https://raw.githubusercontent.com/jarun/buku/refs/heads/master/auto-completion/zsh/_buku"'
__load_or_generate goreleaser 'goreleaser completion zsh'
-__load_or_generate aptly 'curl -sL "https://raw.githubusercontent.com/aptly-dev/aptly/refs/heads/master/completion.d/_aptly"'
+__load_or_generate aptly '__fetch_url "https://raw.githubusercontent.com/aptly-dev/aptly/refs/heads/master/completion.d/_aptly"'
__load_or_generate gh 'gh completion --shell zsh'
__load_or_generate ruff 'ruff generate-shell-completion zsh'
-__load_or_generate yt-dlp 'curl -sL "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.tar.gz" | tar -zxO yt-dlp/completions/zsh/_yt-dlp'
-__load_or_generate qsv 'curl -sL "https://raw.githubusercontent.com/dathere/qsv/refs/heads/master/contrib/completions/examples/qsv.zsh"'
+__load_or_generate yt-dlp '__fetch_url "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.tar.gz" | tar -zxO yt-dlp/completions/zsh/_yt-dlp'
+__load_or_generate qsv '__fetch_url "https://raw.githubusercontent.com/dathere/qsv/refs/heads/master/contrib/completions/examples/qsv.zsh"'
__load_or_generate rustup "rustup completions zsh"
__load_or_generate cargo "rustup completions zsh cargo"
-__load_or_generate aichat 'curl -sL "https://github.com/sigoden/aichat/raw/refs/heads/main/scripts/completions/aichat.zsh"'
+__load_or_generate aichat '__fetch_url "https://github.com/sigoden/aichat/raw/refs/heads/main/scripts/completions/aichat.zsh"'
__load_or_generate mise 'mise completion zsh'
__load_or_generate asdf 'asdf completion zsh'
__load_or_generate uv 'uv generate-shell-completion zsh'
__load_or_generate just 'just --completions zsh'
+__load_or_generate pipx 'register-python-argcomplete pipx'
compdef fdfind=fd
-unset -f __load_completion_if_exists __load_or_generate
+unset -f __load_completion_if_exists __load_or_generate __fetch_url
# vim: et ft=zsh fdm=marker :