Skip to content
Myr

Bash completion variable leak fixes (#1352)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes bash variables leaking into the parent shell without `local`

authored by Ville Skyttä · committed by GitHub · parent b55fa79 · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:bash_completions.go+3 added-1 removed
382 unmodified lines
383func writePostscript(buf io.StringWriter, name string) {384 name = strings.Replace(name, ":", "__", -1)385 WriteStringAndCheck(buf, fmt.Sprintf("__start_%s()\n", name))386 WriteStringAndCheck(buf, fmt.Sprintf(`{387 local cur prev words cword387 local cur prev words cword split388 declare -A flaghash 2>/dev/null || :389 declare -A aliashash 2>/dev/null || :390 if declare -F _init_completion >/dev/null 2>&1; then391 _init_completion -s || return
7 unmodified lines
399 local local_nonpersistent_flags=()400 local flags_with_completion=()401 local flags_completion=()402 local commands=("%[1]s")403 local command_aliases=()404 local must_have_one_flag=()405 local must_have_one_noun=()406 local has_completion_function407 local last_command408 local nouns=()409 local noun_aliases=()410411 __%[1]s_handle_word412}413
270 unmodified lines