Documentation
¶
Index ¶
- Variables
- func Chdir(dir string) error
- func Completer(d prompt.Document) []prompt.Suggest
- func Explore(args []string) error
- func IsCdCmd(pd prompt.Document) bool
- func Pager(content string) error
- func RemovePageSuffix(command string) (string, bool)
- func RunAndCapture(shellBin, command string, page, save bool, ...) error
- func RunNoCapture(shellBin, command string) error
- func RunPtyCapture(shellBin, command string, capture func(int, string) error) error
- func Shell(cfg *api.AppConfig) error
- type FilePathCompleter
- type Sub
- type VisitedRegistry
- type WordCompleter
- type WordCounter
- type WordFreq
- type WordStat
Constants ¶
This section is empty.
Variables ¶
var ( WFreq = 0.7 // frequency weight WRecency = 0.4 // recency weight WLen = 0.3 // length bonus WSepPen = 0.5 // separator-ratio penalty WClass = 0.2 // class weight WComplex = 1.4 // influence of low-complexity detector WInfo = 0.8 // information content (entropy + RLE) )
Scoring knobs
var ( // FilePathCompletionSeparator holds separate characters. FilePathCompletionSeparator = string([]byte{' ', os.PathSeparator}) )
https://github.com/c-bata/go-prompt/blob/master/completer/file.go
Functions ¶
func Chdir ¶
Chdir changes the current working directory to the specified path. This is required to update the PWD environment variable
func RemovePageSuffix ¶
RemovePageSuffix removes a "| page" command suffix. Returns the new command and true if a suffix was removed, otherwise returns the original command and false.
func RunAndCapture ¶
func RunAndCapture(shellBin, command string, page, save bool, capture func(which int, line string) error) error
RunAndCapture runs a command and captures its output line by line.
func RunNoCapture ¶
func RunPtyCapture ¶
Types ¶
type FilePathCompleter ¶
type FilePathCompleter struct {
IgnoreCase bool
}
FilePathCompleter is a completer for your local file system. Please caution that you need to set OptionCompletionWordSeparator(completer.FilePathCompletionSeparator) when you use this completer.
type VisitedRegistry ¶
type VisitedRegistry struct {
// contains filtered or unexported fields
}
func NewVisitedRegistry ¶
func NewVisitedRegistry() (*VisitedRegistry, error)
func (*VisitedRegistry) List ¶
func (r *VisitedRegistry) List() []string
func (*VisitedRegistry) Visit ¶
func (r *VisitedRegistry) Visit(abs string)
type WordCompleter ¶
type WordCompleter struct {
// contains filtered or unexported fields
}
func NewWordCompleter ¶
func NewWordCompleter(headN, tailM int) *WordCompleter
func (*WordCompleter) Capture ¶
func (wc *WordCompleter) Capture(which int, line string) error
Capture captures lines; processes first N synchronously, buffers last M, and processes buffer when which == 99
func (*WordCompleter) Complete ¶
func (wc *WordCompleter) Complete(d prompt.Document) []prompt.Suggest
func (*WordCompleter) Show ¶
func (wc *WordCompleter) Show(word string, top int)
type WordCounter ¶
func DefaultWordCounter ¶
func DefaultWordCounter() *WordCounter
DefaultWordCounter returns a WordCounter with reasonable defaults so callers don’t have to worry about the parameters in the common case.
Defaults:
- maxSize – 100 000 distinct words
- classWeights – nil (all classes weighted equally)
func NewWordCounter ¶
func NewWordCounter(maxSize int, classWeights map[int]float64) *WordCounter
func (*WordCounter) AddWords ¶
func (c *WordCounter) AddWords(words []string)
func (*WordCounter) AddWordsWithClass ¶
func (c *WordCounter) AddWordsWithClass(class int, words []string)