Skip to content

Phase 3: Migrate Input and Password prompts to huh

Overview

Migrate text input and password prompts.

Files to Migrate

  1. internal/commands/auth/login/login.go:272 - Input: Hostname
  2. internal/commands/auth/login/login.go:278 - Input: API Host
  3. internal/commands/auth/login/login.go:345 - Input: Hostname
  4. internal/commands/auth/login/login.go:529 - Password: Token (with validation)

Implementation

// Input
huh.NewInput().
    Title("GitLab hostname:").
    Value(&hostname).
    Placeholder("gitlab.com").
    Run()

// Password with validation
huh.NewInput().
    Title("Paste your authentication token:").
    Value(&token).
    EchoMode(huh.EchoModePassword).
    Validate(func(s string) error {
        if s == "" { return fmt.Errorf("required") }
        return nil
    }).
    Run()

Success Criteria

  • Text inputs work with defaults/placeholders
  • Password masking works
  • Required validation works

Effort: 2 days

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