tui

package
v0.0.0-...-7861e87 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChooseFromListDialog

func ChooseFromListDialog[TItem any](title string, items []TItem, toItemFunc func(item *TItem) (string, string)) (*TItem, error)

Show a dialog to user to select an item from the provided list. The toItemFunc() is used to convert the items into a (name, description) tuple for display. The selected item in the list is returned (or error).

func ChooseOrgAndProject

func ChooseOrgAndProject(orgsAndProjects []portalapi.OrganizationWithProjects) (*portalapi.ProjectInfo, error)

ChooseOrgAndProject fetches all the organizations and projects from the portal (that the user has access to) and then displays an interactive list for the user to choose the project from.

func ChooseTargetPodDialog

func ChooseTargetPodDialog(pods []corev1.Pod) (*corev1.Pod, error)

func DoConfirmDialog

func DoConfirmDialog(ctx context.Context, title string, body string, question string) (bool, error)

Show the user a confirm dialog and wait for a yes/no answer.

func DoConfirmQuestion

func DoConfirmQuestion(ctx context.Context, question string) (bool, error)

Show the user a one-line confirm question and wait for a yes/no answer.

func GetPodDescription

func GetPodDescription(pod *corev1.Pod) string

func GetStatefulSetDescription

func GetStatefulSetDescription(sts *appsv1.StatefulSet) string

func IsInteractiveMode

func IsInteractiveMode() bool

func RequireLoggedIn

func RequireLoggedIn(ctx context.Context, authProvider *auth.AuthProviderConfig) (*auth.TokenSet, error)

RequireLoggedIn ensures that the user is logged in. If the user is not logged in, it will prompt the user to log in.

func SetInteractiveMode

func SetInteractiveMode(isInteractive bool)

Set the interactive mode of the UI library.

Types

type Task

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

Task represents a single task with its title, function, and status

type TaskOutput

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

TaskOutput contains the outputs from a given task and is shown along with the task's status.

func (*TaskOutput) AppendLine

func (to *TaskOutput) AppendLine(line string)

Append a new line at the end of the output.

func (*TaskOutput) AppendLinef

func (to *TaskOutput) AppendLinef(format string, a ...any)

AppendLinef appends a new formatted line at the end of the output using fmt.Sprintf.

func (*TaskOutput) SetFooterLines

func (to *TaskOutput) SetFooterLines(lines []string)

Update the footer lines to the provided ones. Also logged in non-interactive mode.

func (*TaskOutput) SetHeaderLines

func (to *TaskOutput) SetHeaderLines(lines []string)

Update the header lines to the provided ones. Also logged in non-interactive mode.

type TaskRunFunc

type TaskRunFunc func(output *TaskOutput) error

TaskRunFunc is the function signature for task execution functions

type TaskRunner

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

TaskRunner manages and executes a sequence of tasks with visual progress

func NewTaskRunner

func NewTaskRunner() *TaskRunner

NewTaskRunner creates a new TaskRunner

func (*TaskRunner) AddTask

func (m *TaskRunner) AddTask(title string, runFunc TaskRunFunc)

AddTask adds a new task to the runner

func (TaskRunner) Init

func (m TaskRunner) Init() tea.Cmd

Init implements tea.Model

func (*TaskRunner) Run

func (m *TaskRunner) Run() error

Run starts executing tasks sequentially and displays the progress

func (TaskRunner) Update

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

Update implements tea.Model

func (TaskRunner) View

func (m TaskRunner) View() string

View implements tea.Model

type TaskStatus

type TaskStatus int

TaskStatus represents the current state of a task

const (
	StatusPending TaskStatus = iota
	StatusRunning
	StatusCompleted
	StatusFailed
)

Jump to

Keyboard shortcuts

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