txn2 / kubefwd

Bulk port forwarding Kubernetes services for local development.
https://imti.co/kubernetes-port-forwarding/
Apache License 2.0
3.76k stars 204 forks source link

`kubefwd completion bash` generated with kubefwd banner causing syntax error on start up. #230

Closed siakhooi closed 2 years ago

siakhooi commented 2 years ago

Steps to reproduce:

I have download the linux x64 version 1.22.2 after install, i did this command: kubefwd completion bash > /etc/bash_completion.d/kubefwd

when open new terminal, these error came out:

INFO[10:24:22]: command not found
-bash: /etc/bash_completion.d/kubefwd: line 2: syntax error near unexpected token `|'
-bash: /etc/bash_completion.d/kubefwd: line 2: `INFO[10:24:22] | | ___   _| |__   ___ / _|_      ____| |    '
INFO[10:24:22]: command not found
-bash: /etc/bash_completion.d/kubefwd: line 2: syntax error near unexpected token `|'
-bash: /etc/bash_completion.d/kubefwd: line 2: `INFO[10:24:22] | | ___   _| |__   ___ / _|_      ____| |    '
~$

check the /etc/bash_completion.d/kubefwd


~$ head -20 /etc/bash_completion.d/kubefwd
INFO[10:24:22]  _          _           __             _
INFO[10:24:22] | | ___   _| |__   ___ / _|_      ____| |
INFO[10:24:22] | |/ / | | | '_ \ / _ \ |_\ \ /\ / / _  |
INFO[10:24:22] |   <| |_| | |_) |  __/  _|\ V  V / (_| |
INFO[10:24:22] |_|\_\\__,_|_.__/ \___|_|   \_/\_/ \__,_|
INFO[10:24:22]
INFO[10:24:22] Version 1.22.2
INFO[10:24:22] https://github.com/txn2/kubefwd
INFO[10:24:22]
# bash completion V2 for kubefwd                              -*- shell-script -*-

__kubefwd_debug()
{
    if [[ -n ${BASH_COMP_DEBUG_FILE:-} ]]; then
        echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
    fi
}

# Macs have bash3 for which the bash-completion package doesn't include
# _init_completion. This is a minimal version of that function.
cjimti commented 2 years ago

@siakhooi I need to prevent it from printing out the log header for the completion command.

As a workaround, just remove those INFO lines.

cjimti commented 2 years ago

fixed in release 1.22.3