Last active
March 22, 2018 18:58
-
-
Save elyscape/435a40b3c3118becf24c694025c929d8 to your computer and use it in GitHub Desktop.
Script to add/update completion scripts from Docker for Mac. Assumes that bash-completion or bash-completion@2 in installed with Homebrew
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
update-docker-completions() { | |
local prefix suffix srcdir='/Applications/Docker.app/Contents/Resources/etc' | |
# bash | |
prefix='/usr/local/etc/bash_completion.d/' | |
suffix='' | |
for compl in "$srcdir"/*.bash-completion; do | |
ln -sf "$compl" "${prefix}$(basename "${compl%.*-completion}")${suffix}" | |
done | |
# zsh | |
prefix='/usr/local/share/zsh/site-functions/_' | |
suffix='' | |
for compl in "$srcdir"/*.zsh-completion; do | |
ln -sf "$compl" "${prefix}$(basename "${compl%.*-completion}")${suffix}" | |
done | |
# fish | |
prefix='/usr/local/share/fish/vendor_completions.d/' | |
suffix='.fish' | |
for compl in "$srcdir"/*.fish-completion; do | |
ln -sf "$compl" "${prefix}$(basename "${compl%.*-completion}")${suffix}" | |
done | |
} | |
[[ "$0" == "$BASH_SOURCE" ]] && update-docker-completions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment