command

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStyles = Styles{
	InputTextStyle: lipgloss.NewStyle().
		Foreground(lipgloss.Color("#80ed99")),

	InputBarStyle: lipgloss.NewStyle().
		BorderStyle(lipgloss.NormalBorder()).
		BorderForeground(lipgloss.Color("240")).
		BorderTop(true),

	OutputStyle: lipgloss.NewStyle().
		BorderStyle(lipgloss.NormalBorder()).
		BorderForeground(lipgloss.Color("240")).
		BorderTop(true),

	ErrTextStyle: lipgloss.NewStyle().
		Foreground(lipgloss.Color("#FF303E")),

	ExecTimeTextStyle: lipgloss.NewStyle().
		Foreground(lipgloss.Color("#EBBD34")),
}

Functions

func Execute

func Execute(root *cobra.Command, args []string, out io.Writer) error

Execute executes the root command. It requires the input and output sources, as otherwise it'll try to read the STDIN and STDOUT streams. The "args" value contains a complete command expression split into a slice of strings, and the "out" represents io.Writer instance for writing the command execution result.

func NewHelpCmd added in v0.6.0

func NewHelpCmd() *cobra.Command

func NewRootCmd added in v0.6.0

func NewRootCmd(onStateChange func(), csc ...CreateSubCommand) *cobra.Command

func ViewHelp added in v0.6.0

func ViewHelp(cmd *cobra.Command) string

Types

type CreateSubCommand added in v1.0.0

type CreateSubCommand func(onStateChange func()) *cobra.Command

CreateSubCommand defines a custom type for a function that creates a new command instance. The produced command will be assigned as a sub-command to the root command.

type History added in v0.6.0

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

func NewHistory added in v0.6.0

func NewHistory(capacity int) *History

func (*History) Clear added in v0.6.0

func (h *History) Clear()

func (*History) Next added in v0.6.0

func (h *History) Next() (string, bool)

func (*History) Prev added in v0.6.0

func (h *History) Prev() (string, bool)

func (*History) Push added in v0.6.0

func (h *History) Push(entry string)

func (*History) ResetCursor added in v0.6.0

func (h *History) ResetCursor()

func (*History) SetCursor added in v0.6.0

func (h *History) SetCursor(cursor int)

func (*History) Size added in v0.6.0

func (h *History) Size() int

type Model

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

func NewModel

func NewModel(onStateChange func()) *Model

func (*Model) Enable

func (m *Model) Enable()

func (*Model) Enabled

func (m *Model) Enabled() bool

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) SetPathContext

func (m *Model) SetPathContext(path string, entries []string)

func (*Model) SetStyles added in v0.8.0

func (m *Model) SetStyles(s Styles)

func (*Model) Update

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

func (*Model) View

func (m *Model) View() string

type Styles added in v0.8.0

type Styles struct {
	InputTextStyle    lipgloss.Style
	InputBarStyle     lipgloss.Style
	OutputStyle       lipgloss.Style
	ErrTextStyle      lipgloss.Style
	ExecTimeTextStyle lipgloss.Style
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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