Skip to content

Commit c2a87cc

Browse files
committed
refactor(_get_pword): move _get_pword into bash_completion_compat
1 parent c43aead commit c2a87cc

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

bash_completion

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -586,20 +586,6 @@ _comp_get_comp_words_by_ref()
586586
((${#upvars[@]})) && local "${upvars[@]}" && _comp_upvars "${upargs[@]}"
587587
}
588588

589-
# Get word previous to the current word.
590-
# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4
591-
# will properly return the previous word with respect to any given exclusions to
592-
# COMP_WORDBREAKS.
593-
# @deprecated Use `_comp_get_comp_words_by_ref cur prev' instead
594-
# @see _comp_get_comp_words_by_ref()
595-
#
596-
_get_pword()
597-
{
598-
if ((COMP_CWORD >= 1)); then
599-
_get_cword "${@-}" 1
600-
fi
601-
}
602-
603589
# If the word-to-complete contains a colon (:), left-trim COMPREPLY items with
604590
# word-to-complete.
605591
# With a colon in COMP_WORDBREAKS, words containing

bash_completion.d/000_bash_completion_compat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ _get_cword()
130130
fi
131131
} # _get_cword()
132132

133+
# Get word previous to the current word.
134+
# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4
135+
# will properly return the previous word with respect to any given exclusions to
136+
# COMP_WORDBREAKS.
137+
# @deprecated Use `_comp_get_comp_words_by_ref cur prev' instead
138+
# @see _comp_get_comp_words_by_ref()
139+
#
140+
_get_pword()
141+
{
142+
if ((COMP_CWORD >= 1)); then
143+
_get_cword "${@-}" 1
144+
fi
145+
}
146+
133147
# @deprecated Use the variable `_comp_backup_glob` instead. This is the
134148
# backward-compatibility name.
135149
# shellcheck disable=SC2154 # defined in the main "bash_completion"

0 commit comments

Comments
 (0)