explorer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(root *cobra.Command, version string) ([]string, error)

Run launches the interactive explorer TUI. It returns the selected command args (space-separated), or nil if the user quit.

Types

type CommandNode

type CommandNode struct {
	Name        string
	FullPath    string // e.g., "create-user" or "tag1 auth"
	Description string
	LongDesc    string
	Example     string
	Flags       []FlagInfo
	Children    []CommandNode
	IsGroup     bool
}

CommandNode represents a single item in the explorer tree. It is either a group (has children) or a leaf command.

func BuildTree

func BuildTree(root *cobra.Command) CommandNode

BuildTree walks a cobra.Command tree and produces a CommandNode tree, filtering out utility commands.

type FlagInfo

type FlagInfo struct {
	Name        string
	Description string
	Type        string
	Required    bool
	Default     string
}

FlagInfo describes a single flag for display in the detail pane.

type SearchResult

type SearchResult struct {
	Node       CommandNode
	Breadcrumb string // e.g., "pets > create"
	Score      int    // match quality (higher = better)
}

SearchResult represents a match from a recursive tree search.

func SearchTree

func SearchTree(node CommandNode, query string) []SearchResult

SearchTree recursively searches the command tree for nodes matching the query. It returns all matching leaf commands and groups, sorted by match quality, with breadcrumb paths showing where each result lives in the tree hierarchy.

Jump to

Keyboard shortcuts

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