Documentation ¶
Overview ¶
Package managers implements support for command management.
Index ¶
Constants ¶
View Source
const ( ArgumentsHelp = "help" ArgumentsScript = "go run main.go" )
View Source
const (
Version = "3.0.0"
)
Variables ¶
View Source
var ( ArgumentsRegexOption = regexp.MustCompile(`^-`) ArgumentsRegexOptionName = regexp.MustCompile(`^(-+)([a-zA-Z0-9][_a-zA-Z0-9-]*)$`) ArgumentsRegexOptionPairs = regexp.MustCompile(`^-+([a-zA-Z0-9][_a-zA-Z0-9-]*)=(.*)$`) ArgumentsRegexScriptBinary = regexp.MustCompile(`^\./[_a-zA-Z0-9-]+$`) ArgumentsRegexScriptWorking = regexp.MustCompile(`^[_a-zA-Z0-9-]+$`) )
View Source
var ( ValueTypeText = map[ValueType]string{ ValueTypeBoolean: "boolean", ValueTypeFloat: "float", ValueTypeInteger: "integer", ValueTypeString: "string", } )
Functions ¶
This section is empty.
Types ¶
type Arguments ¶
type Arguments interface { Get(key string) string GetHelpSelector() string GetMapper() map[string]string GetScript() string GetSelector() string Has(key string) bool Parse(ss ...string) error }
Arguments operation interface.
func NewArguments ¶
func NewArguments() Arguments
type Command ¶
type Command interface { AddOption(opts ...Option) error GetDescription() string GetHidden() bool GetName() string GetOption(key string) Option GetOptions() map[string]Option Run(manager Manager, arguments Arguments) error SetDescription(s string) Command SetHandler(handler CommandHandler) Command SetHidden(b bool) Command }
Command operation interface.
func NewCommand ¶
type CommandHandler ¶
CommandHandler callable handler on command.
type Manager ¶
type Manager interface { AddCommand(c Command) error GetCommand(key string) Command GetCommands() map[string]Command GetDescription() string Run(a Arguments) error RunTerminal() error SetDescription(s string) Manager }
Manager operation interface.
func NewManager ¶
func NewManager() Manager
type Option ¶
type Option interface { Assign(s string) error Assigned() bool GetDescription() string GetLabel() string GetName() string GetShortName() string SetDefault(v interface{}) Option SetDescription(ss ...string) Option SetMode(m Mode) Option SetShortName(b byte) Option SetValueType(vt ValueType) Option ToBool() (bool, error) ToFloat() (float64, error) ToInt() (int64, error) ToString() (string, error) Validate() error }
Option operation interface.
type OutputManager ¶
OutputManager manager interface.
var ( // Output // manager instance. Output OutputManager )
Click to show internal directories.
Click to hide internal directories.