From f3d5ec2e3ff7dae4b964e61986526078ab4886aa Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sun, 9 Jan 2022 21:30:24 -0800 Subject: [PATCH] completion/bash-it: rename `_bash-it-comp()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...to `_bash-it()`. The norm is for the completion function for, e.g., `teh_cmd`. to be named with the same name and a prepended underscore, i.e. `_teh_cmd`. This alsö reduces namespace confusion, which will be relevant in a future patch. --- completion/available/bash-it.completion.bash | 14 +++++++------- test/completion/bash-it.completion.bats | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/completion/available/bash-it.completion.bash b/completion/available/bash-it.completion.bash index 7ebe9ccc88..1f83d5c8b7 100644 --- a/completion/available/bash-it.completion.bash +++ b/completion/available/bash-it.completion.bash @@ -6,7 +6,7 @@ function _compreply_candidates() { read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}") } -function _bash-it-comp() { +function _bash-it() { local cur prev verb file_type candidates suffix COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" @@ -83,9 +83,9 @@ function _bash-it-comp() { } # Activate completion for bash-it and its common misspellings -complete -F _bash-it-comp bash-it -complete -F _bash-it-comp bash-ti -complete -F _bash-it-comp shit -complete -F _bash-it-comp bashit -complete -F _bash-it-comp batshit -complete -F _bash-it-comp bash_it +complete -F _bash-it bash-it +complete -F _bash-it bash-ti +complete -F _bash-it shit +complete -F _bash-it bashit +complete -F _bash-it batshit +complete -F _bash-it bash_it diff --git a/test/completion/bash-it.completion.bats b/test/completion/bash-it.completion.bats index ceabb1a914..f23361850e 100755 --- a/test/completion/bash-it.completion.bats +++ b/test/completion/bash-it.completion.bats @@ -9,8 +9,8 @@ function local_setup { setup_test_fixture } -@test "completion bash-it: ensure that the _bash-it-comp function is available" { - type -a _bash-it-comp &> /dev/null +@test "completion bash-it: ensure that the _bash-it function is available" { + type -a _bash-it &> /dev/null assert_success } @@ -38,7 +38,7 @@ function __check_completion () { COMP_CWORD=$(( ${#COMP_WORDS[@]} - 1 )) # Run the Bash-it completion function - _bash-it-comp + _bash-it # Return the completion output echo "${COMPREPLY[@]}"