Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(bash-v2): use backslash escape string expansion for tab #1682

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions bash_completionsV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ __%[1]s_handle_completion_types() {
# If the user requested inserting one completion at a time, or all
# completions at once on the command-line we must remove the descriptions.
# https://github.com/spf13/cobra/issues/1508
local tab comp
tab=$(printf '\t')
local tab=$'\t' comp
while IFS='' read -r comp; do
# Strip any description
comp=${comp%%%%$tab*}
Expand All @@ -175,8 +174,7 @@ __%[1]s_handle_completion_types() {
}

__%[1]s_handle_standard_completion_case() {
local tab comp
tab=$(printf '\t')
local tab=$'\t' comp

local longest=0
# Look for the longest completion so that we can format things nicely
Expand Down Expand Up @@ -231,8 +229,7 @@ __%[1]s_handle_special_char()

__%[1]s_format_comp_descriptions()
{
local tab
tab=$(printf '\t')
local tab=$'\t'
local comp="$1"
local longest=$2

Expand Down