ui

package
v1.0.37716-pre Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmModel

type ConfirmModel struct {
	// contains filtered or unexported fields
}

ConfirmModel is a bubbletea model for a y/N confirmation prompt. Press y/Y to confirm, n/N/esc/ctrl+c to decline.

func NewConfirmModel

func NewConfirmModel(prompt string) ConfirmModel

func (ConfirmModel) Confirmed

func (m ConfirmModel) Confirmed() bool

func (ConfirmModel) Done

func (m ConfirmModel) Done() bool

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

func (ConfirmModel) Update

func (m ConfirmModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ConfirmModel) View

func (m ConfirmModel) View() tea.View

type LoginFlowModel

type LoginFlowModel struct {
	// contains filtered or unexported fields
}

LoginFlowModel is a multi-stage bubbletea model that walks the user through CircleCI authentication:

  1. Pick a CircleCI host (circleci.com or a custom URL).
  2. Pick an auth method (browser OAuth or paste a token). 3a. For browser OAuth: press Enter → open browser → wait for callback. 3b. For token: type/paste the personal access token.

After tea.Program.Run() returns, call Result() to read the outcome and Close() to release the OAuth server if one was started.

func NewLoginFlow

func NewLoginFlow(ctx context.Context, opts LoginFlowOptions) LoginFlowModel

NewLoginFlow returns a LoginFlowModel ready to pass to tea.NewProgram.

func (LoginFlowModel) Close

func (m LoginFlowModel) Close()

Close shuts down the OAuth callback server if one was started.

func (LoginFlowModel) Init

func (m LoginFlowModel) Init() tea.Cmd

func (LoginFlowModel) Result

func (m LoginFlowModel) Result() LoginResult

Result returns the final login outcome. Only valid after tea.Program.Run() returns.

func (LoginFlowModel) Update

func (m LoginFlowModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (LoginFlowModel) View

func (m LoginFlowModel) View() tea.View

type LoginFlowOptions

type LoginFlowOptions struct {
	DeviceID string
	OSInfo   string
	// GetUsername, if non-nil, is called after token exchange to display
	// the authenticated user's login name.
	GetUsername func(ctx context.Context, host, token string) (string, error)
	Color       bool
}

LoginFlowOptions configures a LoginFlowModel.

type LoginMethod

type LoginMethod int

LoginMethod indicates which authentication path the user selected.

const (
	LoginMethodBrowser LoginMethod = iota
)

LoginMethodBrowser selects the browser-based OAuth PKCE flow.

type LoginResult

type LoginResult struct {
	Cancelled bool
	Host      string // resolved base URL
	Token     string // set when auth succeeds (either method)
	Username  string // set when GetUsername is provided and succeeds
	Err       error
}

LoginResult is the outcome of a completed LoginFlowModel run.

type PromptModel

type PromptModel struct {
	// contains filtered or unexported fields
}

PromptModel is a bubbletea model for prompting a single line of plain (non-secret) text. Esc / Ctrl+C cancel. Enter confirms.

func NewPromptModel

func NewPromptModel(header, placeholder string) PromptModel

NewPromptModel creates a PromptModel with the given header and an optional placeholder shown inside the empty input field.

func (PromptModel) Init

func (m PromptModel) Init() tea.Cmd

func (PromptModel) Quitting

func (m PromptModel) Quitting() bool

Quitting reports whether the user pressed Esc or Ctrl+C without confirming.

func (PromptModel) Update

func (m PromptModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PromptModel) Value

func (m PromptModel) Value() string

Value returns the entered text.

func (PromptModel) View

func (m PromptModel) View() tea.View

type SecretModel

type SecretModel struct {
	// contains filtered or unexported fields
}

SecretModel is a bubbletea model for prompting a secret value. Input is masked (echo password mode). The prompt header is configurable so callers can name the specific secret being requested.

func NewSecretModel

func NewSecretModel(header string) SecretModel

NewSecretModel creates a SecretModel with the given header text.

func (SecretModel) Init

func (m SecretModel) Init() tea.Cmd

func (SecretModel) Quitting

func (m SecretModel) Quitting() bool

Quitting reports whether the user pressed Esc or Ctrl+C.

func (SecretModel) Update

func (m SecretModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SecretModel) Value

func (m SecretModel) Value() string

Value returns the entered secret value.

func (SecretModel) View

func (m SecretModel) View() tea.View

type SelectModel

type SelectModel struct {
	// contains filtered or unexported fields
}

SelectModel is a top-level bubbletea model that wraps components.SelectModel and quits the program on selection or cancellation.

func NewSelectModel

func NewSelectModel(prompt string, options []string) SelectModel

NewSelectModel creates a standalone select prompt. options is the list of choices to display.

func (SelectModel) Cancelled

func (m SelectModel) Cancelled() bool

Cancelled reports whether the user quit without selecting.

func (SelectModel) Init

func (m SelectModel) Init() tea.Cmd

func (SelectModel) Selected

func (m SelectModel) Selected() int

Selected returns the index of the chosen option. Only valid when !Cancelled().

func (SelectModel) Update

func (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectModel) View

func (m SelectModel) View() tea.View

type SignupFailure

type SignupFailure int
const (
	// SignupFailureNone means the flow did not fail.
	SignupFailureNone SignupFailure = iota
	// SignupFailureSignupListen means the signup callback server could not start.
	SignupFailureSignupListen
	// SignupFailureSignupCallback means the signup callback returned an error.
	SignupFailureSignupCallback
	// SignupFailureSignupExchange means the signup authorization code could not be exchanged.
	SignupFailureSignupExchange
	// SignupFailureLoginListen means the fallback login callback server could not start.
	SignupFailureLoginListen
	// SignupFailureLoginCallback means the fallback login callback returned an error.
	SignupFailureLoginCallback
	// SignupFailureLoginExchange means the fallback login authorization code could not be exchanged.
	SignupFailureLoginExchange
	// SignupFailureUsername means the authenticated username lookup failed.
	SignupFailureUsername
)

type SignupFlowModel

type SignupFlowModel struct {
	// contains filtered or unexported fields
}

func NewSignupFlow

func NewSignupFlow(ctx context.Context, opts SignupFlowOptions) SignupFlowModel

func (SignupFlowModel) Close

func (m SignupFlowModel) Close()

func (SignupFlowModel) Init

func (m SignupFlowModel) Init() tea.Cmd

func (SignupFlowModel) Result

func (m SignupFlowModel) Result() SignupResult

func (SignupFlowModel) Update

func (m SignupFlowModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SignupFlowModel) View

func (m SignupFlowModel) View() tea.View

type SignupFlowOptions

type SignupFlowOptions struct {
	Host                  string
	DeviceID              string
	OSInfo                string
	NoBrowser             bool
	Color                 bool
	SignupCallbackTimeout time.Duration
	LoginCallbackTimeout  time.Duration
	GetUsername           func(ctx context.Context, host, token string) (string, error)
}

type SignupResult

type SignupResult struct {
	Cancelled bool
	Host      string
	Token     string
	Username  string
	Err       error
	Failure   SignupFailure
}

type SpinnerModel

type SpinnerModel struct {
	// contains filtered or unexported fields
}

SpinnerModel is a bubbletea model that displays an animated spinner with a message. Run it in a goroutine via tea.NewProgram; call p.Quit() to stop it.

func NewSpinnerModel

func NewSpinnerModel(msg string, color bool) SpinnerModel

func (SpinnerModel) Init

func (m SpinnerModel) Init() tea.Cmd

func (SpinnerModel) Update

func (m SpinnerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SpinnerModel) View

func (m SpinnerModel) View() tea.View

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL