When the confirm screen is shown for a command with no dedicated TUI
screens (e.g. backup), append a note explaining that the preview may be
incomplete and additional prompts may follow. Points the user to
--show-command for the final resolved command.
@@ -283,6 +283,13 @@ func runInteractive(preselectedCommand string) (command, preset string, override
}
confirmScreen := screens.NewConfirm(previewFn, flagShowCmd)
+ // When the command has no dedicated TUI screens, the
+ // preview may be incomplete — additional prompts can
+ // follow after confirmation.
+ if cmdScreens == nil {
+ confirmScreen.SetPartial(true)
+ }
+
var result []ui.Screen
if cmdScreens != nil {
result = append(result, cmdScreens.list...)
@@ -27,6 +27,7 @@ type previewMsg struct {
type Confirm struct {
previewFn PreviewFunc
showCommand bool
+ partial bool
preview string
selection string
}
@@ -75,11 +76,25 @@ func (c *Confirm) Update(msg tea.Msg) (ui.Screen, tea.Cmd) {
return c, nil
}
-// View renders the command preview.
+// View renders the command preview. When partial is set, a note
+// is appended explaining the preview may be incomplete.
func (c *Confirm) View() string {
- return c.preview
+ if c.preview == "" {
+ return ""
+ }
+ if !c.partial {
+ return c.preview
+ }
+ return c.preview + "\n" + partialNote
}
+// partialNote is shown below the preview when the command has no
+// dedicated TUI screens, meaning the session could not collect all
+// inputs interactively.
+const partialNote = "Note: this preview may be incomplete. " +
+ "Additional prompts may follow after confirmation.\n" +
+ "Use --show-command to see the final command after all inputs are collected."
+
// Title returns the screen's display title.
func (c *Confirm) Title() string { return "Confirm execution" }
@@ -90,6 +105,10 @@ func (c *Confirm) KeyBindings() []key.Binding {
}
}
+// SetPartial marks the preview as potentially incomplete because
+// the command has no dedicated TUI screens to collect all inputs.
+func (c *Confirm) SetPartial(partial bool) { c.partial = partial }
+
// Selection returns "confirmed" after the user presses Enter, or ""
// if the screen has not been confirmed yet.
func (c *Confirm) Selection() string { return c.selection }