uicmd

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package uicmd provides UI command utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatHelp

func FormatHelp(cmd *Command) string

FormatHelp formats command help.

func Parse

func Parse(input string) (name string, args []string)

Parse parses a command string.

Types

type Arg

type Arg struct {
	Name        string
	Description string
	Required    bool
	Default     string
	Type        ArgType
	Choices     []string
}

Arg represents a command argument.

type ArgType

type ArgType int

ArgType represents the type of an argument.

const (
	ArgTypeString ArgType = iota
	ArgTypeInt
	ArgTypeBool
	ArgTypeFloat
	ArgTypeFile
	ArgTypeDir
	ArgTypeChoice
)

type CloseArgumentsDialogMsg

type CloseArgumentsDialogMsg struct{}

CloseArgumentsDialogMsg is sent to close arguments dialog.

type Command

type Command struct {
	Name        string
	Description string
	Title       string
	Shortcut    string
	Aliases     []string
	Args        []Arg
	Run         func(args []string) error
	Handler     Handler
	ID          string
}

Command represents a UI command.

func LoadCustomCommands

func LoadCustomCommands() ([]Command, error)

LoadCustomCommands loads custom commands.

func LoadMCPPrompts

func LoadMCPPrompts() []Command

LoadMCPPrompts loads MCP prompts.

type CommandRunCustomMsg

type CommandRunCustomMsg struct {
	Command string
	Content string
}

CommandRunCustomMsg is sent when a custom command is run.

type CommandType

type CommandType int

CommandType represents the type of command.

const (
	SystemCommands CommandType = iota
	UserCommands
	MCPPrompts
)

func (CommandType) String

func (c CommandType) String() string

String returns a string representation of CommandType.

type Handler

type Handler func(cmd Command) tea.Cmd

Handler is a function that handles a command and returns a tea.Cmd.

type MCPPrompt

type MCPPrompt struct {
	Name        string
	Title       string
	Description string
	Arguments   []*Arg
}

MCPPrompt represents an MCP prompt definition.

type Registry

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

Registry holds registered commands.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new command registry.

func (*Registry) Get

func (r *Registry) Get(name string) *Command

Get gets a command by name.

func (*Registry) List

func (r *Registry) List() []*Command

List returns all commands.

func (*Registry) Register

func (r *Registry) Register(cmd *Command)

Register registers a command.

type ShowArgumentsDialogMsg

type ShowArgumentsDialogMsg struct {
	Command     string
	CommandID   string
	Description string
	ArgNames    []string
	OnSubmit    func(args map[string]string) tea.Cmd
}

ShowArgumentsDialogMsg is sent to show arguments dialog.

type ShowMCPPromptArgumentsDialogMsg

type ShowMCPPromptArgumentsDialogMsg struct {
	PromptName string
	Prompt     *MCPPrompt
	OnSubmit   func(args map[string]string) tea.Cmd
}

ShowMCPPromptArgumentsDialogMsg is sent to show MCP prompt arguments dialog.

Jump to

Keyboard shortcuts

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