Documentation ¶
Index ¶
- Constants
- Variables
- func Confirm(label string, defaultY bool) bool
- func FixedSelect(label string, choices []string, opt ...SelectFn) (int, string)
- func Input(label string, fns ...InputOption) string
- func InputPassword(label string, validateFunc func(string) error) string
- func InterruptableInput(label string, fns ...InputOption) (text string, interrupted bool)
- func PressEnterToContinue()
- func PressEnterToContinueWithHint(hint string)
- func Select(label string, choices []string, opt ...SelectFn) (int, string)
- func SelectWithSearch(label string, choices []string, opt ...SelectFn) int
- func WithProgress(name string, duration time.Duration, fn func())
- type BucketKV
- func (kv *BucketKV) Delete(key string) error
- func (kv *BucketKV) Get(key string, valPtr interface{}) error
- func (kv *BucketKV) GetBytes(key string) []byte
- func (kv *BucketKV) GetString(key string) string
- func (kv *BucketKV) Put(key string, val interface{}) error
- func (kv *BucketKV) PutWithTTL(key string, val interface{}, ttlSec uint32) error
- type ComplexSelect
- type FileDB
- type InputOption
- type ItemHistoryBucket
- type Keyer
- type MatchedTerm
- type Progress
- type ProgressBar
- type SearchObj
- type SelectFn
- type SelectWidget
- type Style
- type Suggest
- type Table
- type Term
- type TermWriter
Constants ¶
View Source
const ( ModeNorm selectListMode = iota ModeSearch )
View Source
const ( ParamInputHintSymbol = ">" PromptTypeFile = "FILE " PromptTypeDir = "DIR " PromptTypeDefault = "DEFAULT" PromptTypeHistory = "HISTORY" )
Variables ¶
View Source
var (
MaxItemHistoryBucket = 100
)
Functions ¶
func Input ¶
func Input(label string, fns ...InputOption) string
func InputPassword ¶
InputPassword with mask
func InterruptableInput ¶
func InterruptableInput(label string, fns ...InputOption) (text string, interrupted bool)
func PressEnterToContinue ¶
func PressEnterToContinue()
func PressEnterToContinueWithHint ¶
func PressEnterToContinueWithHint(hint string)
func SelectWithSearch ¶
SelectWithSearch from menu
func WithProgress ¶
Types ¶
type ComplexSelect ¶
type ComplexSelect struct {
// contains filtered or unexported fields
}
func NewComplexSelect ¶
func NewComplexSelect(initialIndex int, items []string) *ComplexSelect
func NewComplexSelectWithHints ¶
func NewComplexSelectWithHints(initialIndex int, items, hints []string) *ComplexSelect
func (*ComplexSelect) InNormMode ¶
func (sl *ComplexSelect) InNormMode() bool
func (*ComplexSelect) InSearchMode ¶
func (sl *ComplexSelect) InSearchMode() bool
InSearchMode is in search mode
func (*ComplexSelect) IsSelectNothing ¶
func (sl *ComplexSelect) IsSelectNothing() bool
IsSelectNothing true: exit with nothing selected
func (*ComplexSelect) Selected ¶
func (sl *ComplexSelect) Selected() int
Selected return selected index
func (*ComplexSelect) Show ¶
func (slist *ComplexSelect) Show()
type FileDB ¶
type FileDB struct {
// contains filtered or unexported fields
}
func MustNewHomeFileDB ¶
func NewHomeFileDB ¶
func (*FileDB) GetBucketKV ¶
func (*FileDB) GetItemHistoryBucket ¶
func (fdb *FileDB) GetItemHistoryBucket(bucket string, size int) *ItemHistoryBucket
type InputOption ¶
type InputOption func(*inputOption)
func WithFileBrowser ¶
func WithFileBrowser() InputOption
func WithHint ¶
func WithHint() InputOption
func WithRecentName ¶
func WithRecentName(ns string) InputOption
func WithSuggestions ¶
func WithSuggestions(list []Suggest) InputOption
func WithValidator ¶
func WithValidator(v func(string) error) InputOption
type ItemHistoryBucket ¶
type ItemHistoryBucket struct { DB *FileDB // contains filtered or unexported fields }
func (*ItemHistoryBucket) InsertItem ¶
func (ih *ItemHistoryBucket) InsertItem(v interface{}) error
func (*ItemHistoryBucket) ListItem ¶
func (ih *ItemHistoryBucket) ListItem(retSlicePtr interface{}) error
type MatchedTerm ¶
func (MatchedTerm) IsMatched ¶
func (mt MatchedTerm) IsMatched() bool
type Progress ¶
type Progress struct { Bars []ProgressBar // contains filtered or unexported fields }
func NewProgress ¶
func NewProgress() *Progress
type ProgressBar ¶
type ProgressBar interface { Finish() Cancel() }
type SearchObj ¶
type SearchObj struct { // filted results indices after searching SearchResultsIndices []int // cursor location, index of SearchResultsIndices SelectedResultIndex int // current query string QueryStr string // base title displayed when searching SearchTitle string // contains filtered or unexported fields }
type SelectFn ¶
type SelectFn func(*SelectWidget)
type SelectWidget ¶
type Table ¶
type TermWriter ¶
type TermWriter struct {
// contains filtered or unexported fields
}
func NewTermWriter ¶
func NewTermWriter() *TermWriter
func (*TermWriter) AddTerm ¶
func (b *TermWriter) AddTerm(name string, prefixReg string, endingText string) error
func (*TermWriter) DataChan ¶
func (b *TermWriter) DataChan() <-chan MatchedTerm
func (*TermWriter) Stop ¶
func (b *TermWriter) Stop()
Click to show internal directories.
Click to hide internal directories.