Skip to content

[UX-793] rpk prompt: add raw as an option to prompt params#29219

Merged
r-vasquez merged 1 commit into
redpanda-data:devfrom
r-vasquez:raw-prompt
Jan 14, 2026
Merged

[UX-793] rpk prompt: add raw as an option to prompt params#29219
r-vasquez merged 1 commit into
redpanda-data:devfrom
r-vasquez:raw-prompt

Conversation

@r-vasquez

Copy link
Copy Markdown
Contributor

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

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x

Release Notes

Improvements

  • rpk profile prompt: add 'raw' as a modifier option to our prompt parsing.

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
@r-vasquez r-vasquez requested review from Copilot and twmb January 10, 2026 00:43
@r-vasquez r-vasquez requested review from a team and kbatuigas as code owners January 10, 2026 00:43
@r-vasquez r-vasquez requested review from graham-rp and removed request for a team January 10, 2026 00:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@vbotbuildovich

Copy link
Copy Markdown
Collaborator

CI test results

test results on build#78850
test_class test_method test_arguments test_kind job_url test_status passed reason test_history
MountUnmountIcebergTest test_simple_remount {"cloud_storage_type": 1} integration https://buildkite.com/redpanda/redpanda/builds/78850#019ba564-02c9-4261-a738-328b1fe5dd44 FLAKY 8/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.2082, p0=0.6484, reject_threshold=0.0100. adj_baseline=0.5036, p1=0.0522, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=MountUnmountIcebergTest&test_method=test_simple_remount
RedpandaNodeOperationsSmokeTest test_node_ops_smoke_test {"cloud_storage_type": 1, "mixed_versions": false} integration https://buildkite.com/redpanda/redpanda/builds/78850#019ba565-0851-44fc-b144-32a6440c34e5 FLAKY 22/31 Test PASSES after retries.No significant increase in flaky rate(baseline=0.1154, p0=0.0178, reject_threshold=0.0100. adj_baseline=0.3079, p1=0.3948, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=RedpandaNodeOperationsSmokeTest&test_method=test_node_ops_smoke_test

@r-vasquez r-vasquez merged commit 3a0afd8 into redpanda-data:dev Jan 14, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants