Skip to content

Phase 2: Migrate binary Select prompts to huh

Overview

Migrate Select prompts with 2 options (basically Confirm with custom labels).

Files to Migrate

  1. internal/commands/mr/update/mr_update.go:355

    • Options: "Submit", "Cancel"
    • Returns: cmdutils action
    • Complexity: 2/10
  2. internal/commands/mr/merge/mr_merge.go:311

    • Options: "Submit", "Cancel"
    • Complexity: 2/10

Implementation Options

// Option A: Use Confirm with custom labels
confirm := huh.NewConfirm().
    Title("What would you like to do?").
    Affirmative("Submit").
    Negative("Cancel").
    Value(&shouldSubmit)

// Option B: Use Select
var selected string
huh.NewSelect[string]().
    Title("What would you like to do?").
    Options(
        huh.NewOption("Submit", "submit"),
        huh.NewOption("Cancel", "cancel"),
    ).
    Value(&selected).
    Run()

Success Criteria

  • All 2-option selects work
  • Keyboard navigation works
  • Cancel/Ctrl+C handling works

Effort: 2-3 days

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information