completions: fix mixed tab/spaces indentation (#1473)

These templates use 4 spaces for indentation, but some lines
used tabs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-12-07 23:57:57 +01:00 committed by GitHub
parent c7a4421715
commit 507caf5ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -238,13 +238,13 @@ __%[1]s_handle_reply()
fi fi
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
if declare -F __%[1]s_custom_func >/dev/null; then if declare -F __%[1]s_custom_func >/dev/null; then
# try command name qualified custom func # try command name qualified custom func
__%[1]s_custom_func __%[1]s_custom_func
else else
# otherwise fall back to unqualified for compatibility # otherwise fall back to unqualified for compatibility
declare -F __custom_func >/dev/null && __custom_func declare -F __custom_func >/dev/null && __custom_func
fi fi
fi fi
# available in bash-completion >= 2, not always present on macOS # available in bash-completion >= 2, not always present on macOS
@ -309,7 +309,7 @@ __%[1]s_handle_flag()
# skip the argument to a two word flag # skip the argument to a two word flag
if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then
__%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument"
c=$((c+1)) c=$((c+1))
# if we are looking for a flags value, don't show commands # if we are looking for a flags value, don't show commands
if [[ $c -eq $cword ]]; then if [[ $c -eq $cword ]]; then

View File

@ -50,7 +50,7 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock {
if ($Command.Length -gt $CursorPosition) { if ($Command.Length -gt $CursorPosition) {
$Command=$Command.Substring(0,$CursorPosition) $Command=$Command.Substring(0,$CursorPosition)
} }
__%[1]s_debug "Truncated command: $Command" __%[1]s_debug "Truncated command: $Command"
$ShellCompDirectiveError=%[3]d $ShellCompDirectiveError=%[3]d
$ShellCompDirectiveNoSpace=%[4]d $ShellCompDirectiveNoSpace=%[4]d
@ -58,7 +58,7 @@ Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock {
$ShellCompDirectiveFilterFileExt=%[6]d $ShellCompDirectiveFilterFileExt=%[6]d
$ShellCompDirectiveFilterDirs=%[7]d $ShellCompDirectiveFilterDirs=%[7]d
# Prepare the command to request completions for the program. # Prepare the command to request completions for the program.
# Split the command at the first space to separate the program and arguments. # Split the command at the first space to separate the program and arguments.
$Program,$Arguments = $Command.Split(" ",2) $Program,$Arguments = $Command.Split(" ",2)
$RequestComp="$Program %[2]s $Arguments" $RequestComp="$Program %[2]s $Arguments"

View File

@ -250,7 +250,7 @@ _%[1]s()
# don't run the completion function when being source-ed or eval-ed # don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_%[1]s" ]; then if [ "$funcstack[1]" = "_%[1]s" ]; then
_%[1]s _%[1]s
fi fi
`, name, compCmd, `, name, compCmd,
ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,