Documentation
¶
Index ¶
- func MinimumNArgs(args []string, n int) error
- type AutoCompleter
- type Cli
- func (c *Cli) Commands() []Command
- func (c *Cli) Config() *Config
- func (c *Cli) ParseCommands(commander interface{}) error
- func (c *Cli) PostRun(postRun func(args []string))
- func (c *Cli) PreRun(preRun func(args []string))
- func (c *Cli) Run(name string, app interface{}) error
- func (c *Cli) SetCommands(commands []Command)
- func (c *Cli) SetConfig(config *Config)
- type Command
- type Config
- type Option
- func WithAutoComplete(autoComplete AutoCompleter) Option
- func WithCommands(commands []Command) Option
- func WithConfig(config *Config) Option
- func WithDisableAutoSaveHistory(disableAutoSaveHistory bool) Option
- func WithEOFPrompt(EOFPrompt string) Option
- func WithHistoryFile(historyFile string) Option
- func WithHistoryLimit(historyLimit int) Option
- func WithHistorySearchFold(historySearchFold bool) Option
- func WithInterruptPrompt(interruptPrompt string) Option
- func WithPrompt(prompt string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinimumNArgs ¶
Types ¶
type AutoCompleter ¶
type AutoCompleter interface { // Readline will pass the whole line and current offset to it // Completer need to pass all the candidates, and how long they shared the same characters in line // Example: // [go, git, git-shell, grep] // Do("g", 1) => ["o", "it", "it-shell", "rep"], 1 // Do("gi", 2) => ["t", "t-shell"], 2 // Do("git", 3) => ["", "-shell"], 3 Do(line []rune, pos int) (newLine [][]rune, length int) }
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
func (*Cli) ParseCommands ¶
func (*Cli) SetCommands ¶
type Option ¶
func WithAutoComplete ¶
func WithAutoComplete(autoComplete AutoCompleter) Option
WithAutoComplete AutoCompleter will called once user press TAB
func WithCommands ¶
func WithConfig ¶
func WithEOFPrompt ¶
func WithHistoryFile ¶
func WithHistoryLimit ¶
WithHistoryLimit specify the max length of historys, it's 500 by default, set it to -1 to disable history
func WithHistorySearchFold ¶
WithHistorySearchFold enable case-insensitive history searching
func WithInterruptPrompt ¶
func WithPrompt ¶
Click to show internal directories.
Click to hide internal directories.