Documentation
¶
Index ¶
- func Expand() cli.Action
- func FlagsAndArgs() cli.Action
- func SetPartialExpand(b ...bool) cli.Action
- func SetURITemplateVar(v ...*Var) cli.Action
- func SetURITemplateVars(v ...*Vars) cli.Action
- func SourceAnnotation() (string, string)
- type URITemplate
- func (u *URITemplate) Expand(value any) (string, error)
- func (u *URITemplate) MarshalText() ([]byte, error)
- func (u *URITemplate) Names() []string
- func (u *URITemplate) PartialExpand(value any) (*URITemplate, error)
- func (u *URITemplate) Set(arg string) error
- func (u *URITemplate) String() string
- func (u *URITemplate) UnmarshalText(b []byte) error
- type Var
- type VarType
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlagsAndArgs ¶
func FlagsAndArgs() cli.Action
func SetPartialExpand ¶
func SetPartialExpand(b ...bool) cli.Action
func SetURITemplateVar ¶
func SetURITemplateVar(v ...*Var) cli.Action
func SetURITemplateVars ¶
func SetURITemplateVars(v ...*Vars) cli.Action
func SourceAnnotation ¶
SourceAnnotation gets the name and value of the annotation added to the Data of all flags that are initialized from this package
Types ¶
type URITemplate ¶
type URITemplate struct {
// contains filtered or unexported fields
}
URITemplate is a parsed representation of a URI template, which can also be used as a flag Value
func Parse ¶
func Parse(text string) (*URITemplate, error)
Parse obtains a URI template from a string
func (*URITemplate) Expand ¶
func (u *URITemplate) Expand(value any) (string, error)
Expand expands a URI template. The value is Vars, a map[string]any, or an arbitrary struct (or pointer to one). When a struct, reflection is used to obtain the values by name, and the tag `uri` can be used to override the name.
func (*URITemplate) MarshalText ¶
func (u *URITemplate) MarshalText() ([]byte, error)
MarshalText provides the textual representation
func (*URITemplate) Names ¶
func (u *URITemplate) Names() []string
Names retrieves the names of the template variables
func (*URITemplate) PartialExpand ¶
func (u *URITemplate) PartialExpand(value any) (*URITemplate, error)
PartialExpand expands a URI template, leaving any expansions which could not be filled
func (*URITemplate) Set ¶
func (u *URITemplate) Set(arg string) error
Set provides the behavior when the template is used as a flag on the command line
func (*URITemplate) String ¶
func (u *URITemplate) String() string
String converts the template to a string
func (*URITemplate) UnmarshalText ¶
func (u *URITemplate) UnmarshalText(b []byte) error
UnmarshalText converts the textual representation
type Var ¶
Var is a variable in a URI template
func (*Var) NewCounter ¶
func (v *Var) NewCounter() cli.ArgCounter
type VarType ¶
type VarType int
VarType enumerates the types of variables in the expression of a URI template