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

fix: (config) only respect the --command flag once #2096

Merged
merged 1 commit into from
May 21, 2023

Conversation

tyzbit
Copy link
Contributor

@tyzbit tyzbit commented May 18, 2023

We want to switch to the command specified by the flag, but only at startup.

Afterwards, we should be interactive and favor the user's command choices over the startup commandline switch.

Sidenote: I'm not very familiar with k9s's codebase, so I didn't see any .Lock() I should be calling when updating the *Config object or if updating via pointer is not advised. Give me a hint and I'll run from there 😎

Bug introduced in #2045
Fixes #2085

cc: @kinoute (thank you for reporting this!)

We want to switch to the command specified by the flag, but only at startup.

Afterwards, we should be interactive and favor the user's command choices over the startup commandline switch.
Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tyzbit Yes I think it makes sense. As your previous commit entailed calling activeView which ends up pulling the command arg again and hence loading the context command again ;( Thank you for the fix!!

I do think a better solution would be to allow user to specify a default view in the k9s config directly aka defaultView as there are currently other places in the code which yields pod view as the default.

@derailed derailed merged commit 91cac5e into derailed:master May 21, 2023
@derailed derailed mentioned this pull request Nov 8, 2023
placintaalexandru pushed a commit to placintaalexandru/k9s that referenced this pull request Apr 3, 2024
We want to switch to the command specified by the flag, but only at startup.

Afterwards, we should be interactive and favor the user's command choices over the startup commandline switch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When specifying the context command via the -c flag, selecting a cluster always returns to the context view
3 participants