Documentation ¶
Index ¶
- Constants
- func BuiltinLanguages() []string
- func GetLanguage(preferredLanguage string, mapping map[string][]string) (languages []string)
- func PrintProgress(task *CalculateTask)
- func RegisterHandler(name string, handler Handler)
- func RegisterInjector(name string, injector Injector)
- type ApplicationConfig
- type CalculateTask
- type CommandConfig
- type CommandLine
- type DescriptionConfig
- type ExampleType
- type Handler
- type HandlerItem
- type HandlerNotFoundError
- type Injector
- type InjectorItem
- type InjectorNotFoundError
- type Input
- type NodeType
- type Params
- type TranslatedItem
- type TranslationSet
Constants ¶
View Source
const ( FunctionNameDefaultVersion = "AcDefaultVersionFn" FunctionNameDefaultExit = "AcDefaultExitFn" )
Variables ¶
This section is empty.
Functions ¶
func BuiltinLanguages ¶
func BuiltinLanguages() []string
func GetLanguage ¶
func PrintProgress ¶
func PrintProgress(task *CalculateTask)
func RegisterHandler ¶
func RegisterInjector ¶
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct { Version string `json:"version" yaml:"version"` Copyright string `json:"copyright" yaml:"copyright"` ReleasedAt string `json:"released_at" yaml:"released_at"` CaseSensitive bool `json:"case_sensitive" yaml:"case_sensitive"` CliPrefix string `json:"cli_prefix" yaml:"cli_prefix"` PreferredLanguage string `json:"preferred_language" yaml:"preferred_language"` Commands map[string]CommandConfig `json:"commands" yaml:"commands,omitempty"` Debug bool `json:"debug" yaml:"debug"` LanguageMapping map[string][]string `json:"language_mapping" yaml:"language_mapping"` }
type CalculateTask ¶
type CalculateTask struct {
// contains filtered or unexported fields
}
func NewCalculateTask ¶
func NewCalculateTask(taskName string, totalTasks int, tickInterval time.Duration, options ...progressbar.Option) *CalculateTask
func (*CalculateTask) RefreshName ¶
func (task *CalculateTask) RefreshName(name string)
func (*CalculateTask) RefreshProgress ¶
func (task *CalculateTask) RefreshProgress(progress int)
type CommandConfig ¶
type CommandConfig struct { Type string `json:"type" yaml:"type"` Handler string `json:"handler" yaml:"handler"` Examples string `json:"examples" yaml:"examples"` Descriptions []DescriptionConfig `json:"descriptions" yaml:"descriptions"` Commands map[string]CommandConfig `json:"commands" yaml:"commands"` }
type CommandLine ¶
type CommandLine interface { Execute(options ...prompt.Option) Matcher(document prompt.Document) (suggestions []prompt.Suggest, startChar, endChar pstrings.RuneNumber) }
func NewCli ¶
func NewCli(cfg ApplicationConfig) CommandLine
type DescriptionConfig ¶
type ExampleType ¶
type ExampleType = string
type Handler ¶
type Handler func(input *Input)
func DefaultExitHandler ¶
func DefaultExitHandler() Handler
func DefaultHandler ¶
func DefaultHandler() Handler
func GetHandler ¶
func NoCommandHandler ¶
func NoCommandHandler() Handler
type HandlerItem ¶
type HandlerNotFoundError ¶
type HandlerNotFoundError struct { CommandPath string HandlerName string // contains filtered or unexported fields }
func (HandlerNotFoundError) Error ¶
func (e HandlerNotFoundError) Error() string
type Injector ¶
type Injector func(input *Input) (result []TranslationSet)
func GetInjector ¶
func StaticInjector ¶
func StaticInjector(statics []TranslationSet) Injector
type InjectorItem ¶
type InjectorNotFoundError ¶
type InjectorNotFoundError struct { CommandPath string InjectorName string // contains filtered or unexported fields }
func (InjectorNotFoundError) Error ¶
func (e InjectorNotFoundError) Error() string
type TranslatedItem ¶
type TranslationSet ¶
type TranslationSet struct {
// contains filtered or unexported fields
}
func (*TranslationSet) GetTranslation ¶
func (ts *TranslationSet) GetTranslation(languages ...string) (key, description string)
func (*TranslationSet) InitTranslations ¶
func (ts *TranslationSet) InitTranslations(items []TranslatedItem)
Click to show internal directories.
Click to hide internal directories.