Problem
The core prompt primitives always append : to the supplied message. When a caller already ends its message with punctuation, the rendered prompt contains doubled punctuation such as ?: or ::.
This affects the shared Confirm, Prompt, Select, and MultiSelect renderers in cli/azd/pkg/ux/, so it should be fixed once in the primitive rather than worked around at individual call sites.
Examples from main
cli/azd/pkg/infra/provisioning/provision_validation.go passes a confirm message ending in a question mark:
Message: fmt.Sprintf("Proceed with %s despite the warnings above?", action),
The Confirm primitive appends another colon, producing output like:
? Proceed with provisioning despite the warnings above?: [Y/n]
cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go passes a select message ending in a colon:
Message: "Select a deployment to continue:",
The Select primitive appends another colon, producing output like:
? Select a deployment to continue::
The current primitive behaviour comes from renderers formatting every message as %s: regardless of its final character.
Expected behaviour
Append : only when the trimmed message does not already end in terminal punctuation. Messages ending in punctuation such as ?, :, ., !, or ; should retain that punctuation and receive only the trailing space needed before the hint, value, or selected result.
Examples:
| Input message |
Rendered message segment |
Continue |
Continue: |
Continue? |
Continue? |
Select a deployment: |
Select a deployment: |
Acceptance criteria
- Centralize the formatting rule in a small shared helper.
- Apply it consistently to Confirm, Prompt, Select, and MultiSelect.
- Preserve the existing colon for messages without terminal punctuation.
- Trim trailing whitespace before checking the final character.
- Add focused unit coverage for plain messages and messages ending in each supported punctuation character.
- Confirm existing prompt rendering and interaction tests continue to pass.
Problem
The core prompt primitives always append
:to the supplied message. When a caller already ends its message with punctuation, the rendered prompt contains doubled punctuation such as?:or::.This affects the shared Confirm, Prompt, Select, and MultiSelect renderers in
cli/azd/pkg/ux/, so it should be fixed once in the primitive rather than worked around at individual call sites.Examples from
maincli/azd/pkg/infra/provisioning/provision_validation.gopasses a confirm message ending in a question mark:The Confirm primitive appends another colon, producing output like:
cli/azd/pkg/infra/provisioning/bicep/bicep_provider.gopasses a select message ending in a colon:The Select primitive appends another colon, producing output like:
The current primitive behaviour comes from renderers formatting every message as
%s:regardless of its final character.Expected behaviour
Append
:only when the trimmed message does not already end in terminal punctuation. Messages ending in punctuation such as?,:,.,!, or;should retain that punctuation and receive only the trailing space needed before the hint, value, or selected result.Examples:
ContinueContinue:Continue?Continue?Select a deployment:Select a deployment:Acceptance criteria