Skip to content

Commit a56a7a2

Browse files
authored
Merge pull request #2063 from gaelicWizard/lib/completion/components - I know she's borken but I can fix her!
2 parents 8474502 + 0c792ef commit a56a7a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+353
-186
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# shellcheck shell=bash
22
about-completion "apm completion"
3-
# shellcheck disable=SC1090
4-
source "${BASH_IT}"/vendor/github.com/vigo/apm-bash-completion/apm
3+
# shellcheck source-path=SCRIPTDIR/../../vendor/github.com/vigo/apm-bash-completion
4+
source "${BASH_IT?}/vendor/github.com/vigo/apm-bash-completion/apm"
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# shellcheck shell=bash
2-
if _command_exists awless; then
3-
# shellcheck disable=SC1090
4-
source <(awless completion bash)
5-
fi
2+
3+
# Make sure awless is installed
4+
_bash-it-completion-helper-necessary awless || return
5+
6+
# Don't handle completion if it's already managed
7+
_bash-it-completion-helper-sufficient awless || return
8+
9+
# shellcheck disable=SC1090
10+
source <(awless completion bash)
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# shellcheck shell=bash
22

3-
if _command_exists aws_completer; then
4-
complete -C "$(command -v aws_completer)" aws
5-
fi
3+
# Make sure aws is installed
4+
_bash-it-completion-helper-necessary aws aws_completer || return
5+
6+
# Don't handle completion if it's already managed
7+
_bash-it-completion-helper-sufficient aws || return
8+
9+
complete -C aws_completer aws
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# shellcheck shell=bash
2-
# cargo (Rust package manager) completion
2+
about-completion "cargo (Rust package manager) completion"
33

4-
if _binary_exists rustup && _binary_exists cargo; then
5-
eval "$(rustup completions bash cargo)"
6-
fi
4+
# Make sure cargo is installed
5+
_bash-it-completion-helper-necessary rustup cargo || return
6+
7+
# Don't handle completion if it's already managed
8+
_bash-it-completion-helper-sufficient cargo || return
9+
10+
eval "$(rustup completions bash cargo)"

completion/available/conda.completion.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# shellcheck shell=bash
2-
cite "about-completion"
32
about-completion "conda completion"
43

54
if _command_exists conda; then
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# shellcheck shell=bash
2-
cite "about-completion"
32
about-completion "Hashicorp consul completion"
43

5-
if _command_exists consul; then
6-
complete -C "$(command -v consul)" consul
7-
fi
4+
# Make sure consul is installed
5+
_bash-it-completion-helper-necessary consul || return
6+
7+
# Don't handle completion if it's already managed
8+
_bash-it-completion-helper-sufficient consul || return
9+
10+
complete -C consul consul
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# shellcheck shell=bash
2-
_log_warning 'Bash completion for "crystal" is now covered by "system". This completion can be disabled.'
2+
3+
_log_warning 'Bash completion for "crystal" is now covered by "system".'
4+
_disable-completion "crystal"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# shellcheck shell=bash
22
# shellcheck disable=SC1090
33

4-
if test -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"; then
5-
source "$_"
4+
if [[ -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash" ]]; then
5+
# shellcheck source-path=SCRIPTDIR/../../vendor/github.com/gaelicWizard/bash-progcomp
6+
source "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"
67
fi
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# shellcheck shell=bash
2-
# Bash completion support for the 'dirs' plugin (commands G, R).
2+
about-completion "Bash completion support for the 'dirs' plugin (commands G, R)."
33

4-
_dirs-complete() {
5-
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
6-
7-
# parse all defined shortcuts from ~/.dirs
8-
if [ -r "$HOME/.dirs" ]; then
9-
# shellcheck disable=SC2207
10-
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- "${CURRENT_PROMPT}"))
4+
function _dirs-complete() {
5+
# parse all defined shortcuts ${BASH_IT_DIRS_BKS}
6+
if [[ -s "${BASH_IT_DIRS_BKS:-/dev/null}" ]]; then
7+
IFS=$'\n' read -d '' -ra COMPREPLY < <(grep -v '^#' "${BASH_IT_DIRS_BKS?}" | sed -e 's/\(.*\)=.*/\1/')
118
fi
129

1310
return 0
1411
}
1512

16-
complete -o default -o nospace -F _dirs-complete G R
13+
complete -o default -o nospace -F _dirs-complete -X '!&*' G R
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
# shellcheck shell=bash
22

3-
function __dmidecode_completion() {
4-
# shellcheck disable=SC2155
5-
local prev=$(_get_pword)
6-
# shellcheck disable=SC2155
7-
local curr=$(_get_cword)
3+
# Make sure dmidecode is installed
4+
_bash-it-completion-helper-necessary dmidecode || :
5+
6+
# Don't handle completion if it's already managed
7+
_bash-it-completion-helper-sufficient dmidecode || return
8+
9+
function _dmidecode() {
10+
local prev="${COMP_WORDS[COMP_CWORD - 1]}"
811

912
case $prev in
1013
-s | --string | -t | --type)
1114
OPTS=$(dmidecode "$prev" 2>&1 | grep -E '^ ' | sed 's/ *//g')
1215
# shellcheck disable=SC2207
13-
COMPREPLY=($(compgen -W "$OPTS" -- "$curr"))
16+
COMPREPLY=("${OPTS[@]}")
1417
;;
1518
dmidecode)
1619
# shellcheck disable=SC2207
17-
COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr"))
20+
COMPREPLY=("-d" "--dev-mem" "-h" "--help" "-q" "--quiet" "-s" "--string" "-t" "--type" "-H" "--handle" "-u" "--dump" "-dump-bin" "--from-dump" "--no-sysfs" "--oem-string" "-V" "--version")
1821
;;
1922
esac
2023
}
2124

22-
complete -F __dmidecode_completion dmidecode
25+
complete -F _dmidecode -X '!&*' dmidecode

0 commit comments

Comments
 (0)