Documentation ¶
Index ¶
- func GetDefaultTemplates() []string
- func GetTemplate(template string) (string, bool)
- func GetTemplateOptions(template string) (map[string]interface{}, bool)
- func ShowHelpPlugin(w io.Writer)
- func ShowHelpTemplate(w io.Writer)
- type Cache
- type Config
- type Plugin
- type Prompt
- func (pr Prompt) Cache(key string, value interface{}) error
- func (pr *Prompt) Compile(tmpl string) string
- func (pr Prompt) GetCache(key string) (interface{}, bool)
- func (pr Prompt) GetOption(key string) (interface{}, bool)
- func (pr *Prompt) Load(plugin string) (string, error)
- func (pr *Prompt) Prefix(prefix, input string) string
- func (pr *Prompt) Replace(expr, repl, src string) (string, error)
- func (pr *Prompt) Suffix(suffix, input string) string
- func (pr *Prompt) Wrap(prefix, suffix string, input string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultTemplates ¶
func GetDefaultTemplates() []string
GetDefaultTemplates returns the default templates defined by the prompt package
func GetTemplate ¶
GetTemplate returns the a default template by its name
func GetTemplateOptions ¶
GetTemplateOptions returns the default options for a default template
func ShowHelpTemplate ¶
ShowHelpTemplate writes on w the templating help
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents a cache data store
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the struct to fetch the config
func NewConfigFromFile ¶
NewConfigFromFile loads the config from a file and returns the config
func (*Config) GetCustomTemplate ¶
GetCustomTemplate returns the configured custom templatefile
func (*Config) GetOptions ¶
GetOptions return the configured options
func (*Config) GetTemplate ¶
GetTemplate returns the configured predefined template
type Plugin ¶
type Plugin interface { Name() string Help() (description string, options map[string]string) Load(pr plugin.Prompter) error Get(format func(string, ...termcolor.Mode) string) (string, []termcolor.Mode) }
Plugin is the interface all the plugins MUST implement
type Prompt ¶
type Prompt struct {
// contains filtered or unexported fields
}
Prompt is the struct with the prompt options/config