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

devspace completion prints info statement that results in command not found when executed/sourced #1864

Closed
matskiv opened this issue Jan 14, 2022 · 1 comment
Labels
kind/bug Something isn't working

Comments

@matskiv
Copy link
Contributor

matskiv commented Jan 14, 2022

What happened?
Running source <(devspace completion bash) causes the error below:

bash: ommand not found...
bash: 36m[info]: command not found...

This happens when one of the parent folders of the current working directory contains a devspace.yaml file.
For me, this happens when I open a new tab or split a terminal in my terminal emulator while in a subfolder of a project that uses devspace.

What did you expect to happen instead?
Not printing [info] Using devspace config in ... when running devspace completion, and thus no error message.

How can we reproduce the bug? (as minimally and precisely as possible)

cd /tmp && mkdir test && cd test && touch devspace.yaml && mkdir subfolder && cd subfolder/ && devspace completion bash | head -n 1

You will see [info] Using devspace config in /tmp/test printed.
Instead, you should see something like # bash completion for devspace ...

Local Environment:

  • DevSpace Version: 5.18.2
  • Operating System: linux
  • ARCH of the OS: AMD64

Workaround:
source <(devspace completion bash | grep -v -e "Using devspace config in")

/kind bug

@matskiv
Copy link
Contributor Author

matskiv commented Jan 14, 2022

I had a quick look at the code.
The info message in question gets printed by configLoader.SetDevSpaceRoot() that's called from cmd.getCommands() here - https://github.com/loft-sh/devspace/blob/a5eac169596719ace76d4824fb8e1b085581dc25/cmd/run.go#L206
I couldn't quickly come up with an elegant solution that would preserve all other functionality, so I'll probably leave this to folks more familiar with the code base. :)

@matskiv matskiv added the kind/bug Something isn't working label Jan 14, 2022
@loft-bot loft-bot changed the title devspace completion prints info statement that results in command not found when executed/sourced devspace completion prints info statement that results in command not found when executed/sourced Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants