kyma-project / cli

Simple set of commands to manage a Kyma installation
Apache License 2.0
111 stars 118 forks source link

kyma completion bash #2118

Closed frnksgr closed 6 hours ago

frnksgr commented 1 month ago

Description

Calling 'kyma completion bash' writes warnings/errors to stdout which can not be evaluated by bash, causing errors when the output is sourced.

For example (kyma version 2.20.4):

kyma completion bash 2>/dev/null | head 
WARNING: All commands within v2 are deprecated. We are designing v3 of kyma CLI  with a new set of commands that will be first released  within alpha command group. 

# bash completion for kyma                                 -*- shell-script -*-

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

Expected result

Warnings should be written to stderr. 'kyma completion bash 2>/dev/null' should only contain valid bash code (no error messages).

Actual result

For example call 'kyma completion bash 2>/dev/null' on an outdated version and you cannot source it, because of warning/error messages at the beginning written to stdout: 'source <(kyma completion bash 2>/dev/null)' will fail.

Steps to reproduce

See above.

Troubleshooting

See above.

halamix2 commented 4 days ago

Fixed in 2.20.5, deprecation notice is now printed to stderr

kwiatekus commented 6 hours ago

Thank you. Tested manually :

➜  kyma version > bla
WARNING: All commands within v2 are deprecated. We are designing v3 of kyma CLI with a new set of commands that will be first released within alpha command group.

➜  cat bla
Kyma CLI version: 2.20.5
Kyma cluster version: N/A