tui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package tui renders a form.Field tree as an interactive terminal form using the charmbracelet huh library. It is the bridge between clic's UI-agnostic field description and a concrete, runnable form; the field-to-value assembly is kept separate from the rendering so it can be tested without a terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromptBody

func PromptBody(fields []form.Field) (map[string]any, error)

PromptBody renders an interactive form for the given fields and returns the collected values assembled into a request-body map. Optional fields left blank are omitted from the result.

func RunStudio added in v0.8.0

func RunStudio(ctx context.Context, app StudioApp, selected []string) error

RunStudio launches the full-screen studio for the given app. When selected is non-empty it names a command path (e.g. ["pets","getById"]) to pre-select and focus on launch. The context carries clic's options and auth for execution.

Types

type Command added in v0.8.0

type Command struct {
	Name        string
	Description string
	Provider    provider.Provider
	Subcommands []Command
}

Command is the studio's view of one node in an app's command tree: a runnable leaf (Provider set) or a group (Subcommands set). It deliberately mirrors only what the studio needs, so the tui package depends on provider but not on spec.

type StudioApp added in v0.8.0

type StudioApp struct {
	Name        string
	Description string
	Server      string
	Commands    []Command
}

StudioApp is the input to RunStudio: an app's identity plus its command tree.

Jump to

Keyboard shortcuts

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