Documentation
¶
Index ¶
- Variables
- func AppendHistory(path, line string)
- func Bold(s string) string
- func Cyan(s string) string
- func Dim(s string) string
- func Green(s string) string
- func HistoryFile(name string) string
- func LoadHistory(path string) []string
- func Magenta(s string) string
- func Red(s string) string
- func TruncateMiddle(s string, n int) string
- func Yellow(s string) string
- type AppHooks
- type CLIApp
- func (a *CLIApp) DispatchREPLLine(lineArgs []string) (quit bool, err error)
- func (a *CLIApp) Execute(cliArgs []string) error
- func (a *CLIApp) FlagHelpText() string
- func (a *CLIApp) Flags() *FlagSet
- func (a *CLIApp) HelpForCmd(c *CLICommand, canonical string) string
- func (a *CLIApp) Hooks() AppHooks
- func (a *CLIApp) InstallHelpVersionFlags()
- func (a *CLIApp) IsKnownCommand(word string) bool
- func (a *CLIApp) Register(c *CLICommand)
- func (a *CLIApp) Resolve(name string) (*CLICommand, string)
- func (a *CLIApp) SetUserData(ud any)
- func (a *CLIApp) UserData() any
- type CLICommand
- type Choice
- type CmdEntry
- type FlagSet
- type GroupEntry
- type IO
- type InputField
- type Prompter
- func (p *Prompter) Confirm(title string, defYes bool) (bool, error)
- func (p *Prompter) ConfirmKeyword(keyword string, action string) (bool, error)
- func (p *Prompter) Input(f InputField) (string, error)
- func (p *Prompter) Select(title string, choices []Choice, def string) (string, error)
- func (p *Prompter) SelectNth(title string, choices []Choice, defIdx int) (int, error)
- func (p *Prompter) Text(title string, desc string, def string, validate func(string) error) (string, error)
- type RunContext
- type TabDef
- type TabShell
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUserAborted = huh.ErrUserAborted
Functions ¶
func AppendHistory ¶
func AppendHistory(path, line string)
func HistoryFile ¶
func LoadHistory ¶
func TruncateMiddle ¶
Types ¶
type AppHooks ¶
type AppHooks struct {
BeforeRun func(ctx RunContext, name string, args []string) error
OnUnknown func(ctx RunContext, args []string) (handled bool, err error)
NeedsContext func(name string, args []string) bool
Banner func(ctx RunContext) string
GlobalHelp func(ctx RunContext, groups map[string][]GroupEntry, flagHelpText string) string
HelpFor func(ctx RunContext, c *CLICommand, canonical string) string
Prompt func(ctx RunContext) string
REPLQuit func(word string) bool
DispatchError func(ctx RunContext, err error)
EnterREPL func(ctx RunContext) error
}
type CLIApp ¶
type CLIApp struct {
// contains filtered or unexported fields
}
func (*CLIApp) DispatchREPLLine ¶
func (*CLIApp) FlagHelpText ¶
func (*CLIApp) HelpForCmd ¶
func (a *CLIApp) HelpForCmd(c *CLICommand, canonical string) string
func (*CLIApp) InstallHelpVersionFlags ¶
func (a *CLIApp) InstallHelpVersionFlags()
func (*CLIApp) IsKnownCommand ¶
func (*CLIApp) Register ¶
func (a *CLIApp) Register(c *CLICommand)
func (*CLIApp) SetUserData ¶
type CLICommand ¶
type CLICommand struct {
Use string
Aliases []string
Short string
Long string
Run func(ctx RunContext, args []string) error
MinArgs int
MaxArgs int
Hidden bool
// AllowFlags permits "-x"-style tokens after the subcommand name so the
// command can parse its own flag set (redis-cli style). Without it, dash
// tokens after a subcommand are rejected as misplaced global flags.
AllowFlags bool
}
type FlagSet ¶
type FlagSet struct {
// contains filtered or unexported fields
}
type GroupEntry ¶
type InputField ¶
type Prompter ¶
type Prompter struct{}
func NewPrompter ¶
func NewPrompter() *Prompter
func (*Prompter) ConfirmKeyword ¶
type RunContext ¶
type TabShell ¶
type TabShell struct {
// contains filtered or unexported fields
}
func NewTabShell ¶
func (*TabShell) PrependBanner ¶
Click to show internal directories.
Click to hide internal directories.