-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
completions: clear and consistent log messages
TODO: `pew` TODO: `source <(flutter bash-completion)` vs `eval $(flutter bash-completion)`...saves a subshell...
- Loading branch information
1 parent
37148ce
commit a49c7c5
Showing
34 changed files
with
376 additions
and
117 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# shellcheck shell=bash | ||
about-completion "apm completion" | ||
# shellcheck disable=SC1090 | ||
source "${BASH_IT}"/vendor/github.com/vigo/apm-bash-completion/apm | ||
# shellcheck source-path=SCRIPTDIR/../../vendor/github.com/vigo/apm-bash-completion | ||
source "${BASH_IT?}/vendor/github.com/vigo/apm-bash-completion/apm" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
# shellcheck shell=bash | ||
if _command_exists awless; then | ||
# shellcheck disable=SC1090 | ||
source <(awless completion bash) | ||
|
||
# Make sure awless is installed | ||
if ! _binary_exists awless; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists awless; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
# shellcheck disable=SC1090 | ||
source <(awless completion bash) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
# shellcheck shell=bash | ||
|
||
if _command_exists aws_completer | ||
then | ||
complete -C "$(command -v aws_completer)" aws | ||
# Make sure aws is installed | ||
if ! _binary_exists aws_completer || ! _binary_exists aws; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists aws; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
complete -C aws_completer aws |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
# shellcheck shell=bash | ||
# cargo (Rust package manager) completion | ||
about-completion "cargo (Rust package manager) completion" | ||
|
||
if _binary_exists rustup && _binary_exists cargo; then | ||
eval "$(rustup completions bash cargo)" | ||
# Make sure cargo is installed | ||
if ! _binary_exists rustup || ! _binary_exists cargo; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists cargo; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(rustup completions bash cargo)" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
# shellcheck shell=bash | ||
cite "about-completion" | ||
about-completion "Hashicorp consul completion" | ||
|
||
if _command_exists consul; then | ||
complete -C "$(command -v consul)" consul | ||
# Make sure consul is installed | ||
if ! _binary_exists consul; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists consul; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
complete -C consul consul |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# shellcheck shell=bash | ||
|
||
if test -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"; then | ||
source "$_" | ||
if [[ -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash" ]]; then | ||
# shellcheck source-path=SCRIPTDIR/../../vendor/github.com/gaelicWizard/bash-progcomp | ||
source "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash" | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
# shellcheck shell=bash | ||
cite "about-completion" | ||
about-completion "docker completion" | ||
|
||
# Make sure docker is installed | ||
_command_exists docker || return | ||
if ! _binary_exists docker; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
_completion_exists docker && return | ||
if _completion_exists docker; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
_docker_bash_completion_paths=( | ||
# MacOS | ||
# MacOS App | ||
'/Applications/Docker.app/Contents/Resources/etc/docker.bash-completion' | ||
# Linux | ||
# Command Line | ||
'/usr/share/bash-completion/completions/docker' | ||
) | ||
|
||
for fn in "${_docker_bash_completion_paths[@]}"; do | ||
if [ -r "$fn" ]; then | ||
# Load the first completion file found | ||
_docker_bash_completion_found=false | ||
for _comp_path in "${_docker_bash_completion_paths[@]}"; do | ||
if [[ -r "$_comp_path" ]]; then | ||
_docker_bash_completion_found=true | ||
# shellcheck disable=SC1090 | ||
source "$fn" | ||
source "$_comp_path" | ||
break | ||
fi | ||
done | ||
|
||
# Cleanup | ||
if [[ "${_docker_bash_completion_found}" == false ]]; then | ||
_log_warning "no completion files found - please try enabling the 'system' completion instead." | ||
fi | ||
unset "${!_docker_bash_completion@}" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
#!/usr/bin/bash | ||
# shellcheck shell=bash | ||
|
||
if _command_exists flutter; then | ||
eval "$(flutter bash-completion)" | ||
# Make sure flutter is installed | ||
if ! _binary_exists flutter; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists flutter; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(flutter bash-completion)" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
# shellcheck shell=bash | ||
cite "about-completion" | ||
about-completion "GitHub CLI completion" | ||
|
||
if _binary_exists gh; then | ||
# If gh already completed, stop | ||
_completion_exists gh && return | ||
eval "$(gh completion --shell=bash)" | ||
if ! _binary_exists gh; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists gh; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(gh completion --shell=bash)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
# shellcheck shell=bash | ||
cite "about-completion" | ||
about-completion "helm (Kubernetes Package Manager) completion" | ||
|
||
if _command_exists helm; then | ||
eval "$(helm completion bash)" | ||
# Make sure helm is installed | ||
if ! _binary_exists helm; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists helm; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(helm completion bash)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
# shellcheck shell=bash | ||
cite "about-completion" | ||
about-completion "jungle(AWS cli tool) completion" | ||
|
||
if _command_exists jungle; then | ||
eval "$(_JUNGLE_COMPLETE=source jungle)" | ||
# Make sure jungle is installed | ||
if ! _binary_exists jungle; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists jungle; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(_JUNGLE_COMPLETE=source jungle)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck shell=bash | ||
|
||
if _command_exists kind; then | ||
eval "$(kind completion bash)" | ||
# Make sure kind is installed | ||
if ! _binary_exists kind; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists kind; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(kind completion bash)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
# shellcheck shell=bash | ||
if _command_exists kontena; then | ||
# shellcheck disable=SC1090 | ||
source "$(kontena whoami --bash-completion-path)" | ||
|
||
# Make sure kontena is installed | ||
if ! _binary_exists kontena; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists kontena; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
# shellcheck disable=SC1090 | ||
source "$(kontena whoami --bash-completion-path)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
# shellcheck shell=bash | ||
cite "about-completion" | ||
about-completion "kubectl (Kubernetes CLI) completion" | ||
|
||
if _binary_exists kubectl; then | ||
eval "$(kubectl completion bash)" | ||
# Make sure kubectl is installed | ||
if ! _binary_exists kubectl; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists kubectl; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(kubectl completion bash)" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
# shellcheck shell=bash | ||
# minikube (Local Kubernetes) completion | ||
about-completion "minikube (Local Kubernetes) completion" | ||
|
||
if _command_exists minikube; then | ||
eval "$(minikube completion bash)" | ||
# Make sure minikube is installed | ||
if ! _binary_exists minikube; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists minikube; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
eval "$(minikube completion bash)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
_command_exists minishift && source <(minishift completion bash) | ||
# shellcheck shell=bash | ||
|
||
# Make sure minishift is installed | ||
if ! _binary_exists minishift; then | ||
_log_warning "Without '$_' installed, this completion won't be too useful." | ||
return 1 | ||
fi | ||
|
||
# Don't handle completion if it's already managed | ||
if _completion_exists minishift; then | ||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion" | ||
return 0 | ||
fi | ||
|
||
# shellcheck disable=SC1090 | ||
source <(minishift completion bash) |
Oops, something went wrong.