Skip to content

Commit

Permalink
completion/bash-it: rename _bash-it-comp()
Browse files Browse the repository at this point in the history
...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.
  • Loading branch information
gaelicWizard committed Jan 10, 2022
1 parent cadbd04 commit f3d5ec2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions completion/available/bash-it.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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]}"
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions test/completion/bash-it.completion.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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[@]}"
Expand Down

0 comments on commit f3d5ec2

Please sign in to comment.