Documentation ¶
Index ¶
- Constants
- type Arg
- type ArgDescription
- type Description
- type Entries
- func (s *Entries) All(f func(Entry) bool) bool
- func (s *Entries) Any(f func(Entry) bool) bool
- func (s *Entries) Append(items ...Entry)
- func (s *Entries) Clear()
- func (s *Entries) Clone() *Entries
- func (s *Entries) Concat(another *Entries) *Entries
- func (s *Entries) CountBy(f func(Entry) bool) uint
- func (s *Entries) DoUntil(f func(Entry) bool) int
- func (s *Entries) DoUntilError(f func(Entry) error) error
- func (s *Entries) DoWhile(f func(Entry) bool) int
- func (s *Entries) Filter(f func(Entry) bool) *Entries
- func (s *Entries) FilterMap(f interface{}) interface{}
- func (s *Entries) FindBy(f func(Entry) bool) int
- func (s *Entries) FindLastBy(f func(Entry) bool) int
- func (s *Entries) Fold(init Entry, f func(Entry, Entry) Entry) Entry
- func (s *Entries) ForEach(f func(Entry))
- func (s *Entries) ForEachWithIndex(f func(int, Entry))
- func (s *Entries) GroupBy(f func(Entry) interface{}) map[interface{}]*Entries
- func (s *Entries) GroupByBool(f func(Entry) bool) (trueGroup, falseGroup *Entries)
- func (s Entries) GroupByInt(f func(Entry) int) map[int]*Entries
- func (s Entries) GroupByStr(f func(Entry) string) map[string]*Entries
- func (s *Entries) InPlaceConcat(another *Entries)
- func (s *Entries) Index(idx int) *Entry
- func (s *Entries) IndexFrom(idx int) *Entries
- func (s *Entries) IndexRange(from, to int) *Entries
- func (s *Entries) IndexTo(idx int) *Entries
- func (s *Entries) Insert(idx int, items ...Entry)
- func (s *Entries) IsEmpty() bool
- func (s *Entries) Len() int
- func (s *Entries) Map(f interface{}) interface{}
- func (s Entries) MarshalJSON() ([]byte, error)
- func (s *Entries) Reduce(f func(Entry, Entry) Entry) Entry
- func (s *Entries) Remove(idx int)
- func (s *Entries) RemoveFrom(idx int)
- func (s *Entries) RemoveRange(from, to int)
- func (s *Entries) RemoveTo(idx int)
- func (s *Entries) String() string
- func (s *Entries) ToSlice() []Entry
- func (s *Entries) ToSliceRef() []Entry
- func (s *Entries) UnmarshalJSON(b []byte) error
- type Entry
- type Env
- type Flag
- type FlagDescription
- type Import
- type ImportSet
- func (set *ImportSet) All(f func(Import) bool) bool
- func (set *ImportSet) Any(f func(Import) bool) bool
- func (set *ImportSet) Append(keys ...Import)
- func (set *ImportSet) Clear()
- func (set *ImportSet) Clone() *ImportSet
- func (set *ImportSet) Contains(key Import) bool
- func (set *ImportSet) ContainsAll(keys ...Import) bool
- func (set *ImportSet) ContainsAny(keys ...Import) bool
- func (set *ImportSet) CountBy(f func(Import) bool) int
- func (set *ImportSet) Difference(another *ImportSet) *ImportSet
- func (set *ImportSet) DoUntil(f func(Import) bool) int
- func (set *ImportSet) DoUntilError(f func(Import) error) error
- func (set *ImportSet) DoWhile(f func(Import) bool) int
- func (set *ImportSet) Equal(another *ImportSet) bool
- func (set *ImportSet) Filter(f func(Import) bool) *ImportSet
- func (set *ImportSet) FilterMap(f interface{}) interface{}
- func (set *ImportSet) FindBy(f func(Import) bool) *Import
- func (set *ImportSet) FindLastBy(f func(Import) bool) *Import
- func (set *ImportSet) Fold(init Import, f func(Import, Import) Import) Import
- func (set *ImportSet) ForEach(f func(Import))
- func (set *ImportSet) ForEachWithIndex(f func(int, Import))
- func (set *ImportSet) GroupBy(f func(Import) interface{}) map[interface{}]*ImportSet
- func (set *ImportSet) GroupByBool(f func(Import) bool) (trueGroup *ImportSet, falseGroup *ImportSet)
- func (set *ImportSet) GroupByInt(f func(Import) int) map[int]*ImportSet
- func (set *ImportSet) GroupByStr(f func(Import) string) map[string]*ImportSet
- func (set *ImportSet) InPlaceUnion(another *ImportSet)
- func (set *ImportSet) Intersect(another *ImportSet) *ImportSet
- func (set *ImportSet) IsEmpty() bool
- func (set *ImportSet) IsProperSubsetOf(another *ImportSet) bool
- func (set *ImportSet) IsProperSupersetOf(another *ImportSet) bool
- func (set *ImportSet) IsSubsetOf(another *ImportSet) bool
- func (set *ImportSet) IsSupersetOf(another *ImportSet) bool
- func (set *ImportSet) Len() int
- func (set *ImportSet) Map(f interface{}) interface{}
- func (set ImportSet) MarshalJSON() ([]byte, error)
- func (set *ImportSet) Reduce(f func(Import, Import) Import) Import
- func (set *ImportSet) Remove(key Import)
- func (set *ImportSet) String() string
- func (set *ImportSet) ToSlice() []Import
- func (set *ImportSet) ToSliceRef() []Import
- func (set *ImportSet) Union(another *ImportSet) *ImportSet
- func (set *ImportSet) UnmarshalJSON(b []byte) error
- type OptionType
- type Options
- func (opts Options) GetFlag(flag Flag) utils.TriBool
- func (opts Options) GetValue(key string) *Value
- func (opts Options) GetValues(key string) ([]Value, error)
- func (opts Options) GetValuesOrEmpty(key string) []Value
- func (opts *Options) IsEmpty() bool
- func (opts *Options) Merge(another *Options) error
- func (opts Options) MustGetValue(key string) Value
- func (opts *Options) SetArg(arg Arg)
- func (opts *Options) SetFlag(flag string, val utils.TriBool)
- func (opts Options) ValidateOption(optType OptionType, opt string) error
- func (opts Options) WithFlag(flag Flag) bool
- func (opts Options) WithNegativeFlag(flag Flag) bool
- type Plugin
- type PluginSet
- func (set *PluginSet) All(f func(Plugin) bool) bool
- func (set *PluginSet) Any(f func(Plugin) bool) bool
- func (set *PluginSet) Append(keys ...Plugin)
- func (set *PluginSet) Clear()
- func (set *PluginSet) Clone() *PluginSet
- func (set *PluginSet) Contains(key Plugin) bool
- func (set *PluginSet) ContainsAll(keys ...Plugin) bool
- func (set *PluginSet) ContainsAny(keys ...Plugin) bool
- func (set *PluginSet) CountBy(f func(Plugin) bool) int
- func (set *PluginSet) Difference(another *PluginSet) *PluginSet
- func (set *PluginSet) DoUntil(f func(Plugin) bool) int
- func (set *PluginSet) DoUntilError(f func(Plugin) error) error
- func (set *PluginSet) DoWhile(f func(Plugin) bool) int
- func (set *PluginSet) Equal(another *PluginSet) bool
- func (set *PluginSet) Filter(f func(Plugin) bool) *PluginSet
- func (set *PluginSet) FilterMap(f interface{}) interface{}
- func (set *PluginSet) FindBy(f func(Plugin) bool) *Plugin
- func (set *PluginSet) FindLastBy(f func(Plugin) bool) *Plugin
- func (set *PluginSet) Fold(init Plugin, f func(Plugin, Plugin) Plugin) Plugin
- func (set *PluginSet) ForEach(f func(Plugin))
- func (set *PluginSet) ForEachWithIndex(f func(int, Plugin))
- func (set *PluginSet) GroupBy(f func(Plugin) interface{}) map[interface{}]*PluginSet
- func (set *PluginSet) GroupByBool(f func(Plugin) bool) (trueGroup *PluginSet, falseGroup *PluginSet)
- func (set *PluginSet) GroupByInt(f func(Plugin) int) map[int]*PluginSet
- func (set *PluginSet) GroupByStr(f func(Plugin) string) map[string]*PluginSet
- func (set *PluginSet) InPlaceUnion(another *PluginSet)
- func (set *PluginSet) Intersect(another *PluginSet) *PluginSet
- func (set *PluginSet) IsEmpty() bool
- func (set *PluginSet) IsProperSubsetOf(another *PluginSet) bool
- func (set *PluginSet) IsProperSupersetOf(another *PluginSet) bool
- func (set *PluginSet) IsSubsetOf(another *PluginSet) bool
- func (set *PluginSet) IsSupersetOf(another *PluginSet) bool
- func (set *PluginSet) Len() int
- func (set *PluginSet) Map(f interface{}) interface{}
- func (set PluginSet) MarshalJSON() ([]byte, error)
- func (set *PluginSet) Reduce(f func(Plugin, Plugin) Plugin) Plugin
- func (set *PluginSet) Remove(key Plugin)
- func (set *PluginSet) String() string
- func (set *PluginSet) ToSlice() []Plugin
- func (set *PluginSet) ToSliceRef() []Plugin
- func (set *PluginSet) Union(another *PluginSet) *PluginSet
- func (set *PluginSet) UnmarshalJSON(b []byte) error
- type Prerequisites
- type TypeInfo
- type Value
- type ValueSet
- func (set *ValueSet) All(f func(Value) bool) bool
- func (set *ValueSet) Any(f func(Value) bool) bool
- func (set *ValueSet) Append(keys ...Value)
- func (set *ValueSet) Clear()
- func (set *ValueSet) Clone() *ValueSet
- func (set *ValueSet) Contains(key Value) bool
- func (set *ValueSet) ContainsAll(keys ...Value) bool
- func (set *ValueSet) ContainsAny(keys ...Value) bool
- func (set *ValueSet) CountBy(f func(Value) bool) int
- func (set *ValueSet) Difference(another *ValueSet) *ValueSet
- func (set *ValueSet) DoUntil(f func(Value) bool) int
- func (set *ValueSet) DoUntilError(f func(Value) error) error
- func (set *ValueSet) DoWhile(f func(Value) bool) int
- func (set *ValueSet) Equal(another *ValueSet) bool
- func (set *ValueSet) Filter(f func(Value) bool) *ValueSet
- func (set *ValueSet) FilterMap(f interface{}) interface{}
- func (set *ValueSet) FindBy(f func(Value) bool) *Value
- func (set *ValueSet) FindLastBy(f func(Value) bool) *Value
- func (set *ValueSet) Fold(init Value, f func(Value, Value) Value) Value
- func (set *ValueSet) ForEach(f func(Value))
- func (set *ValueSet) ForEachWithIndex(f func(int, Value))
- func (set *ValueSet) GroupBy(f func(Value) interface{}) map[interface{}]*ValueSet
- func (set *ValueSet) GroupByBool(f func(Value) bool) (trueGroup *ValueSet, falseGroup *ValueSet)
- func (set *ValueSet) GroupByInt(f func(Value) int) map[int]*ValueSet
- func (set *ValueSet) GroupByStr(f func(Value) string) map[string]*ValueSet
- func (set *ValueSet) InPlaceUnion(another *ValueSet)
- func (set *ValueSet) Intersect(another *ValueSet) *ValueSet
- func (set *ValueSet) IsEmpty() bool
- func (set *ValueSet) IsProperSubsetOf(another *ValueSet) bool
- func (set *ValueSet) IsProperSupersetOf(another *ValueSet) bool
- func (set *ValueSet) IsSubsetOf(another *ValueSet) bool
- func (set *ValueSet) IsSupersetOf(another *ValueSet) bool
- func (set *ValueSet) Len() int
- func (set *ValueSet) Map(f interface{}) interface{}
- func (set ValueSet) MarshalJSON() ([]byte, error)
- func (set *ValueSet) Reduce(f func(Value, Value) Value) Value
- func (set *ValueSet) Remove(key Value)
- func (set *ValueSet) String() string
- func (set *ValueSet) ToSlice() []Value
- func (set *ValueSet) ToSliceRef() []Value
- func (set *ValueSet) Union(another *ValueSet) *ValueSet
- func (set *ValueSet) UnmarshalJSON(b []byte) error
Constants ¶
View Source
const ( OptionSep = ";" ArgSep = "=" ArgValueSep = "," )
View Source
const ( OptionTypeNone = "" OptionTypeFlag = "flag" OptionTypeArgKey = "arg key" OptionTypeArgValue = "arg value" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgDescription ¶
type Description ¶
type Description struct { Identity string Effect string ValidFlags []FlagDescription ValidArgs []ArgDescription AllowUnexpectedlyFlag bool AllowUnexpectedlyArg bool }
func (Description) ToHelpString ¶
func (desc Description) ToHelpString() string
func (Description) Validate ¶
func (desc Description) Validate(opts *Options) error
type Entries ¶
type Entries struct {
// contains filtered or unexported fields
}
func NewEntries ¶
func NewEntriesFromSlice ¶
func (*Entries) FilterMap ¶
func (s *Entries) FilterMap(f interface{}) interface{}
f: func(Entry) *T
func(Entry) (T, bool) func(Entry) (T, error)
return: []T
func (*Entries) ForEachWithIndex ¶
func (*Entries) GroupByBool ¶
func (*Entries) InPlaceConcat ¶
func (*Entries) IndexRange ¶
func (Entries) MarshalJSON ¶
func (*Entries) RemoveFrom ¶
func (*Entries) RemoveRange ¶
func (*Entries) ToSliceRef ¶
func (*Entries) UnmarshalJSON ¶
type Env ¶
func (Env) SelectImportForType ¶
type FlagDescription ¶
type Import ¶
derive-set: Order=Key
func MakeImport ¶
func MakeImportFromAst ¶
func MakeImportFromAst(i *ast.ImportSpec) Import
func MakeRenamedImport ¶
type ImportSet ¶
type ImportSet struct {
// contains filtered or unexported fields
}
func NewImportSetFromSlice ¶
func (*ImportSet) ContainsAll ¶
func (*ImportSet) ContainsAny ¶
func (*ImportSet) Difference ¶
func (*ImportSet) FilterMap ¶
func (set *ImportSet) FilterMap(f interface{}) interface{}
f: func(Import) *T
func(Import) (T, bool) func(Import) (T, error)
return: []T
func (*ImportSet) ForEachWithIndex ¶
func (*ImportSet) GroupByBool ¶
func (*ImportSet) GroupByInt ¶
func (*ImportSet) GroupByStr ¶
func (*ImportSet) InPlaceUnion ¶
func (*ImportSet) IsProperSubsetOf ¶
func (*ImportSet) IsProperSupersetOf ¶
func (*ImportSet) IsSubsetOf ¶
func (*ImportSet) IsSupersetOf ¶
func (*ImportSet) Map ¶
func (set *ImportSet) Map(f interface{}) interface{}
f: func(Import) T return: []T
func (ImportSet) MarshalJSON ¶
func (*ImportSet) ToSliceRef ¶
NOTICE: efficient but unsafe
func (*ImportSet) UnmarshalJSON ¶
type OptionType ¶
type OptionType string
func (OptionType) IsIdent ¶
func (ot OptionType) IsIdent() bool
func (OptionType) IsUnique ¶
func (ot OptionType) IsUnique() bool
type Options ¶
type Options struct { // TODO keep order Flags map[Flag]utils.TriBool Args map[string]Arg ExistingOption map[string]OptionType }
TODO support base plugin, e.g. plugin to define collection interface for other plugins TODO pop operation TODO arg with default value as flag
func NewOptions ¶
func NewOptions() *Options
func ParseOptions ¶
func (Options) GetValuesOrEmpty ¶
func (Options) MustGetValue ¶
func (Options) ValidateOption ¶
func (opts Options) ValidateOption(optType OptionType, opt string) error
func (Options) WithNegativeFlag ¶
type Plugin ¶
type Plugin interface { Describe() Description GenerateTo(w io.Writer, env Env, typeInfo TypeInfo, opt Options) (Prerequisites, error) }
derive-set: Order=Append
type PluginSet ¶
type PluginSet struct {
// contains filtered or unexported fields
}
func NewPluginSet ¶
func NewPluginSetFromSlice ¶
func (*PluginSet) ContainsAll ¶
func (*PluginSet) ContainsAny ¶
func (*PluginSet) Difference ¶
func (*PluginSet) FilterMap ¶
func (set *PluginSet) FilterMap(f interface{}) interface{}
f: func(Plugin) *T
func(Plugin) (T, bool) func(Plugin) (T, error)
return: []T
func (*PluginSet) ForEachWithIndex ¶
func (*PluginSet) GroupByBool ¶
func (*PluginSet) GroupByInt ¶
func (*PluginSet) GroupByStr ¶
func (*PluginSet) InPlaceUnion ¶
func (*PluginSet) IsProperSubsetOf ¶
func (*PluginSet) IsProperSupersetOf ¶
func (*PluginSet) IsSubsetOf ¶
func (*PluginSet) IsSupersetOf ¶
func (*PluginSet) Map ¶
func (set *PluginSet) Map(f interface{}) interface{}
f: func(Plugin) T return: []T
func (PluginSet) MarshalJSON ¶
func (*PluginSet) ToSliceRef ¶
NOTICE: efficient but unsafe
func (*PluginSet) UnmarshalJSON ¶
type Prerequisites ¶
type Prerequisites struct {
Imports *ImportSet
}
func MakePrerequisites ¶
func MakePrerequisites() Prerequisites
type ValueSet ¶
type ValueSet struct {
// contains filtered or unexported fields
}
func NewValueSet ¶
func NewValueSetFromSlice ¶
func (*ValueSet) ContainsAll ¶
func (*ValueSet) ContainsAny ¶
func (*ValueSet) Difference ¶
func (*ValueSet) FilterMap ¶
func (set *ValueSet) FilterMap(f interface{}) interface{}
f: func(Value) *T
func(Value) (T, bool) func(Value) (T, error)
return: []T
func (*ValueSet) ForEachWithIndex ¶
func (*ValueSet) GroupByBool ¶
func (*ValueSet) GroupByStr ¶
func (*ValueSet) InPlaceUnion ¶
func (*ValueSet) IsProperSubsetOf ¶
func (*ValueSet) IsProperSupersetOf ¶
func (*ValueSet) IsSubsetOf ¶
func (*ValueSet) IsSupersetOf ¶
func (*ValueSet) Map ¶
func (set *ValueSet) Map(f interface{}) interface{}
f: func(Value) T return: []T
func (ValueSet) MarshalJSON ¶
func (*ValueSet) ToSliceRef ¶
NOTICE: efficient but unsafe
func (*ValueSet) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.