Documentation
¶
Index ¶
- Constants
- Variables
- func Accent() lipgloss.TerminalColor
- func Accented(text string) string
- func Brand() lipgloss.TerminalColor
- func Confirm() *huh.Select[bool]
- func CopyFile(src, dest string) error
- func CreateTable() *table.Table
- func Dimmed(text string) string
- func EllipsizeTo(str string, maxLength int) string
- func Error() lipgloss.TerminalColor
- func ExpandTemplate(template string) string
- func ExtractSubdomain(url string) string
- func FileExists(dir fs.FS, filename string) bool
- func HashString(str string) (string, error)
- func MapStrings(strs []string, fn func(string) string) []string
- func MoveDir(src, dest string) error
- func OpenInConsole(dashboardURL, projectId string, params *ConsoleURLParams) error
- func OpenInMeet(livekitURL, token string) error
- func PrintJSON(obj any)
- func PrintJSONTo(w io.Writer, obj any) error
- func SetTheme(name string) error
- func Success() lipgloss.TerminalColor
- func ToUnixPath(p string) string
- func URLSafeName(projectURL string) (string, error)
- func UseTempPath(permanentPath string) (string, func() error, func() error)
- func Warning() lipgloss.TerminalColor
- func WrapToLines(input string, maxLineLength int) []string
- func WrapWith(wrap string) func(string) string
- type ConsoleURLParams
- type OpenTarget
- type Printer
- func (p *Printer) Await(title string, ctx context.Context, action func(ctx context.Context) error) error
- func (p *Printer) Result(a ...any)
- func (p *Printer) ResultWriter() io.Writer
- func (p *Printer) Resultf(format string, a ...any)
- func (p *Printer) Status(a ...any)
- func (p *Printer) StatusWriter() io.Writer
- func (p *Printer) Statusf(format string, a ...any)
- func (p *Printer) WarnWriter() io.Writer
- func (p *Printer) Warnf(format string, a ...any)
- type ThemeName
Constants ¶
const ( MeetURL = "https://meet.livekit.io/custom" ConsoleURLPath = "/projects/%s/agents/console/?" )
Variables ¶
var ( // Theme is the huh form theme for the active color theme. Theme *huh.Theme Fg lipgloss.AdaptiveColor FormBaseStyle lipgloss.Style FormHeaderStyle lipgloss.Style )
Active theme state. Populated by applyTheme; switched once at startup via SetTheme. These are package-level so existing call sites (util.Theme, util.Accented, util.Fg, …) keep working; they are read at render time, which always happens after the theme is selected.
var ( OpenFlag = &cli.StringFlag{ Name: "open", Usage: fmt.Sprintf("Open relevant `APP` in browser, supported options: %v", options), Validator: func(input string) error { if !slices.Contains(options, input) { return fmt.Errorf("invalid open target: %s, supported options: %v", input, options) } return nil }, } )
var ValidThemes = []ThemeName{ThemeDefault, ThemeLiveKit}
ValidThemes lists the selectable theme names, for validation and help text.
Functions ¶
func Accent ¶ added in v2.16.5
func Accent() lipgloss.TerminalColor
func Accented ¶ added in v2.4.5
Accented renders text in the active theme's title style (brand color under livekit).
func Brand ¶ added in v2.16.5
func Brand() lipgloss.TerminalColor
Semantic color accessors. They read the active palette at call time, so they reflect the selected theme even when used to build styles lazily.
func CreateTable ¶
func EllipsizeTo ¶
func Error ¶ added in v2.16.5
func Error() lipgloss.TerminalColor
func ExpandTemplate ¶ added in v2.4.13
func ExtractSubdomain ¶ added in v2.4.6
func HashString ¶
func OpenInConsole ¶ added in v2.16.1
func OpenInConsole(dashboardURL, projectId string, params *ConsoleURLParams) error
func OpenInMeet ¶ added in v2.4.13
func SetTheme ¶ added in v2.16.5
SetTheme selects the active theme by name. An empty name resolves to the default. It returns an error for any other unrecognized name (used to validate `lk set-theme`).
func Success ¶ added in v2.16.5
func Success() lipgloss.TerminalColor
func ToUnixPath ¶ added in v2.5.2
Converts a path (possibly Windows-style) to a Unix-style path.
func URLSafeName ¶
func UseTempPath ¶
Provides a temporary path, a function to relocate it to a permanent path, and a function to clean up the temporary path that should always be deferred in the case of a failure to relocate.
func Warning ¶ added in v2.16.5
func Warning() lipgloss.TerminalColor
func WrapToLines ¶
Types ¶
type ConsoleURLParams ¶ added in v2.16.1
type ConsoleURLParams struct {
AgentName string `url:"agentName,omitempty"`
JobMetadata string `url:"jobMetadata,omitempty"`
RoomName string `url:"roomName,omitempty"`
RoomMetadata string `url:"roomMetadata,omitempty"`
Identity string `url:"identity,omitempty"`
Metadata string `url:"metadata,omitempty"`
Attributes map[string]string `url:"attributes,omitempty"`
Hidden bool `url:"hidden,omitempty"`
AutoStart bool `url:"autoStart,omitempty"`
}
type OpenTarget ¶ added in v2.4.13
type OpenTarget string
const ( OpenTargetMeet OpenTarget = "meet" OpenTargetConsole OpenTarget = "console" )
type Printer ¶ added in v2.16.5
type Printer struct {
Out io.Writer // primary output: data the user might pipe or redirect
Err io.Writer // status, warnings, diagnostics
Quiet bool // suppresses Status (warnings and errors still print)
// contains filtered or unexported fields
}
Printer is a single sink for human-facing CLI output. One instance per process is initialized from the root command and reused everywhere, so all status, warning, and result lines share consistent streams and gating.
func NewPrinter ¶ added in v2.16.5
NewPrinter builds a Printer targeting the given writers. Pass nil to default to os.Stdout / os.Stderr; this is the path tests use with bytes.Buffer.
func (*Printer) Await ¶ added in v2.16.5
func (p *Printer) Await(title string, ctx context.Context, action func(ctx context.Context) error) error
Await runs action while showing a spinner, then returns the action's error.
The spinner is decoration: it only animates when the Printer targets an interactive terminal and is not in quiet mode. Otherwise Await emits the title once as a plain status line (itself suppressed by --quiet) and runs the action without animation, so redirected/piped/CI output stays free of escape sequences and --quiet stays silent.
func (*Printer) Result ¶ added in v2.16.5
Result writes the command's primary output to stdout. Always printed.
func (*Printer) ResultWriter ¶ added in v2.16.5
ResultWriter is the streaming counterpart of Result: always printed.
func (*Printer) Status ¶ added in v2.16.5
Status writes an informational breadcrumb to stderr ("Using project [X]", "Cloning template…"). Suppressed by --quiet. A trailing newline is appended.
func (*Printer) StatusWriter ¶ added in v2.16.5
StatusWriter is the streaming counterpart of Status: io.Discard under --quiet.
func (*Printer) WarnWriter ¶ added in v2.16.5
WarnWriter is the streaming counterpart of Warnf: never silenced.