MCPcopy Create free account
hub / github.com/github/gh-aw / confirmExecution

Function confirmExecution

pkg/cli/run_interactive.go:336–363  ·  view source on GitHub ↗

confirmExecution asks the user to confirm workflow execution

(ctx context.Context, wf *WorkflowOption, inputs []string)

Source from the content-addressed store, hash-verified

334
335// confirmExecution asks the user to confirm workflow execution
336func confirmExecution(ctx context.Context, wf *WorkflowOption, inputs []string) bool {
337 runInteractiveLog.Print("Requesting execution confirmation")
338
339 var confirm bool
340 message := fmt.Sprintf("Run workflow '%s'?", wf.Name)
341
342 if len(inputs) > 0 {
343 message = fmt.Sprintf("Run workflow '%s' with %d input(s)?", wf.Name, len(inputs))
344 }
345
346 form := huh.NewForm(
347 huh.NewGroup(
348 huh.NewConfirm().
349 Title(message).
350 Affirmative("Yes, run it").
351 Negative("No, cancel").
352 Value(&confirm),
353 ),
354 ).WithTheme(styles.HuhTheme).WithAccessible(console.IsAccessibleMode())
355
356 if err := form.RunWithContext(ctx); err != nil {
357 runInteractiveLog.Printf("Confirmation failed: %v", err)
358 return false
359 }
360
361 runInteractiveLog.Printf("User confirmed: %v", confirm)
362 return confirm
363}
364
365// RunWorkflowOptions holds parameters for RunSpecificWorkflowInteractively.
366type RunWorkflowOptions struct {

Callers 2

RunWorkflowInteractivelyFunction · 0.85

Calls 3

IsAccessibleModeFunction · 0.92
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected