Documentation ¶
Index ¶
- Variables
- type CommandNode
- type CommandNodes
- type CompleterFunc
- type ExecutorFunc
- type InterpolateError
- type InterpolateResult
- func (r *InterpolateResult) WithError(err *InterpolateError) *InterpolateResult
- func (r *InterpolateResult) WithMisplacedCursor() *InterpolateResult
- func (r *InterpolateResult) WithMissingRequiredParameters(missingReqParams []string) *InterpolateResult
- func (r *InterpolateResult) WithParameters(parameters ParametersWithValue) *InterpolateResult
- func (r *InterpolateResult) WithRemaining(command *TokanizedCommand) *InterpolateResult
- func (r *InterpolateResult) WithTarget(target *CommandNode) *InterpolateResult
- func (r *InterpolateResult) WithTargetParameter(parameter *Parameter) *InterpolateResult
- type Parameter
- type ParameterWithValue
- type ParametersWithValue
- type TokanizedCommand
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyCommand = errors.New("empty command") ErrInvalidCommand = errors.New("command is invalid") ErrInvalidParameterName = errors.New("parameter name is invalid") ErrInvalidParameterValue = errors.New("parameter value is invalid") ErrEmptyParamaterValue = errors.New("parameter value is not set") )
Functions ¶
This section is empty.
Types ¶
type CommandNode ¶
type CommandNode struct { Name string Description string ExtendedDescription string Parameters []Parameter Executor ExecutorFunc }
type CommandNodes ¶
type CommandNodes []*CommandNode
type CompleterFunc ¶
type CompleterFunc func(ctx context.Context, funcOptions ParametersWithValue) []string
type ExecutorFunc ¶
type InterpolateError ¶
func (InterpolateError) DetailedError ¶
func (e InterpolateError) DetailedError() error
func (*InterpolateError) WithDetails ¶
func (e *InterpolateError) WithDetails(details string) *InterpolateError
type InterpolateResult ¶
type InterpolateResult struct { Parents CommandNodes Target *CommandNode TargetParameter *Parameter Parameters ParametersWithValue Remaining *TokanizedCommand Error *InterpolateError MisplacedCursor bool MissingRequiredParameters []string }
func Interpolate ¶
func Interpolate(ctx context.Context, command *TokanizedCommand, nodes CommandNodes) *InterpolateResult
func NewInterpolateResult ¶
func NewInterpolateResult() *InterpolateResult
func (*InterpolateResult) WithError ¶
func (r *InterpolateResult) WithError(err *InterpolateError) *InterpolateResult
func (*InterpolateResult) WithMisplacedCursor ¶
func (r *InterpolateResult) WithMisplacedCursor() *InterpolateResult
func (*InterpolateResult) WithMissingRequiredParameters ¶
func (r *InterpolateResult) WithMissingRequiredParameters(missingReqParams []string) *InterpolateResult
func (*InterpolateResult) WithParameters ¶
func (r *InterpolateResult) WithParameters(parameters ParametersWithValue) *InterpolateResult
func (*InterpolateResult) WithRemaining ¶
func (r *InterpolateResult) WithRemaining(command *TokanizedCommand) *InterpolateResult
func (*InterpolateResult) WithTarget ¶
func (r *InterpolateResult) WithTarget(target *CommandNode) *InterpolateResult
func (*InterpolateResult) WithTargetParameter ¶
func (r *InterpolateResult) WithTargetParameter(parameter *Parameter) *InterpolateResult
type ParameterWithValue ¶
func (*ParameterWithValue) AsBool ¶
func (p *ParameterWithValue) AsBool() (bool, error)
func (*ParameterWithValue) AsInt32 ¶
func (p *ParameterWithValue) AsInt32() (int32, error)
func (*ParameterWithValue) AsInt64 ¶
func (p *ParameterWithValue) AsInt64() (int64, error)
type ParametersWithValue ¶
type ParametersWithValue map[string]*ParameterWithValue
func (*ParametersWithValue) Get ¶
func (p *ParametersWithValue) Get(name string) (*ParameterWithValue, bool)
func (*ParametersWithValue) IsSet ¶
func (p *ParametersWithValue) IsSet(name string) bool
type TokanizedCommand ¶
func NewTokanizedCommand ¶
func NewTokanizedCommand(tokens []Token, hasTrailingSpace bool, cursorPos int) *TokanizedCommand
func (*TokanizedCommand) Cut ¶
func (c *TokanizedCommand) Cut() (string, *TokanizedCommand)
func (*TokanizedCommand) Len ¶
func (c *TokanizedCommand) Len() int
Click to show internal directories.
Click to hide internal directories.