[UX-793] rpk prompt: add raw as an option to prompt params#29219
Merged
Conversation
This allow us to just pass through the text w/o the ANSI escapes for users who don't want to rely on our color parsing but still want to use the rest of the prompt mechanism. Effectively one could use 'rpk profile current' and achieve the same effect but this is nice to have in case in the future we add more options other than %p/%n
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a "raw" modifier option to the rpk profile prompt command, allowing users to output prompt text without ANSI color escape sequences while still utilizing the prompt parsing mechanism for format strings like %n and %p.
Changes:
- Added "raw" modifier support to the prompt parsing logic
- Updated documentation to explain the raw mode feature
- Added comprehensive test coverage for the raw modifier
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/go/rpk/pkg/cli/profile/prompt.go | Implements raw mode logic in parsePrompt function, adds raw mode documentation, and conditionally applies color formatting based on raw flag |
| src/go/rpk/pkg/cli/profile/prompt_test.go | Adds test cases covering raw modifier behavior in various scenarios including case-insensitivity and interaction with color attributes |
Collaborator
CI test resultstest results on build#78850
|
c-julin
approved these changes
Jan 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows us to just pass through the text w/o
the ANSI escapes for users who don't want to
rely on our color parsing but still want to use
the rest of the prompt mechanism.
Effectively, one could use 'rpk profile current'
and achieve the same effect but this is nice to
have in case in the future we add more options
other than %p/%n
Backports Required
Release Notes
Improvements