Skip to content

feat(prompt): allow custom override for command prompt and filter prompt #3399

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martinblascop
Copy link

For terminals that support emojis, you can have different emojis from command mode and filter mode, giving you a hint in which mode you are, but some terminals do not support emojis.

Add support for custom prompt symbols in command and filter mode, to differentiate them, enhancing a bit the user experience.

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.

@martinblascop I think this make sense.
We do currently use a different border color to differentiate between cmd vs filter modes.
That said I am not sure this warrants the extra configs? Since we could just change the default behavior to use '>' or '/' to be the defaults icons supported or not.
Would this make sense?

README.md Outdated
@@ -431,6 +431,10 @@ You can now override the context portForward default address configuration by se
logoless: false
# Set to true to hide K9s crumbs. Default false
crumbsless: false
# Set custom prompt in command mode. Default to '>'
Copy link
Owner

Choose a reason for hiding this comment

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

nit: perhaps best to use commandPromptPrefix ...

Copy link
Author

Choose a reason for hiding this comment

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

agree

//nolint:exhaustive
switch k {
case model.CommandBuffer:
return userCustomSymbolPrompt(p.app.Config.K9s.GetCommandPromptSymbol())
Copy link
Owner

Choose a reason for hiding this comment

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

I think it might be best to keep prompt configuration all in the configuration.
Thus p.app.Config.K9s.GetPromptPrefix will return either the default prefix or the customized one vs having the prompt figure this out.
Would this make better sense?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that makes sense

@martinblascop martinblascop force-pushed the custom-prompt-symbol branch from 60b725c to 44fad2f Compare June 16, 2025 00:31
@martinblascop
Copy link
Author

martinblascop commented Jun 16, 2025

@martinblascop I think this make sense. We do currently use a different border color to differentiate between cmd vs filter modes. That said I am not sure this warrants the extra configs? Since we could just change the default behavior to use '>' or '/' to be the defaults icons supported or not. Would this make sense?

I'd love to have > and / as default icons. But leaving it open to customization. Hope that's okay.

@martinblascop
Copy link
Author

@derailed I think I have addressed your suggestions, is there something missing?

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.

2 participants