Documentation
¶
Index ¶
- Constants
- func Split(expr, s, sep string) []string
- type ForjAction
- type ForjArg
- func (a *ForjArg) Copier() (p ForjParamCopier)
- func (a *ForjArg) CopyToArg(cmd clier.CmdClauser) *ForjArg
- func (a *ForjArg) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
- func (a *ForjArg) Default(value string) ForjParam
- func (a *ForjArg) GetArg() *ForjArg
- func (a *ForjArg) GetBoolAddr() *bool
- func (a *ForjArg) GetBoolValue() bool
- func (a *ForjArg) GetContextValue(context clier.ParseContexter) (interface{}, bool)
- func (*ForjArg) GetFlag() *ForjFlag
- func (a *ForjArg) GetListValues() []ForjData
- func (a *ForjArg) GetStringAddr() *string
- func (a *ForjArg) GetStringValue() string
- func (f *ForjArg) GetValue() interface{}
- func (a *ForjArg) IsFound() bool
- func (f *ForjArg) IsFromObject(obj *ForjObject) bool
- func (f *ForjArg) IsList() bool
- func (a *ForjArg) Name() string
- func (a *ForjArg) String() string
- func (f *ForjArg) Type() string
- func (a *ForjArg) UpdateObject() error
- type ForjArgList
- func (a *ForjArgList) Copier() (p ForjParamCopier)
- func (a *ForjArgList) CopyToArg(cmd clier.CmdClauser) *ForjArg
- func (a *ForjArgList) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
- func (f *ForjArgList) Default(value string) (ret ForjParam)
- func (a *ForjArgList) GetArgClauser() clier.ArgClauser
- func (f *ForjArgList) GetBoolAddr() *bool
- func (f *ForjArgList) GetBoolValue() bool
- func (a *ForjArgList) GetContextValue(context clier.ParseContexter) (interface{}, bool)
- func (f *ForjArgList) GetListValues() []ForjListData
- func (f *ForjArgList) GetStringAddr() *string
- func (f *ForjArgList) GetStringValue() string
- func (f *ForjArgList) GetValue() interface{}
- func (f *ForjArgList) IsFound() bool
- func (a *ForjArgList) IsFromObject(obj *ForjObject) bool
- func (f *ForjArgList) IsList() bool
- func (a *ForjArgList) Name() string
- func (a *ForjArgList) String() (ret string)
- func (f *ForjArgList) Type() string
- type ForjCli
- func (c *ForjCli) AddActionFlagFromObjectAction(obj_name, obj_action, param_name string) *ForjCli
- func (c *ForjCli) AddActionFlagFromObjectField(param_name string, options *ForjOpts) *ForjCli
- func (c *ForjCli) AddActionFlagFromObjectListAction(obj_name, obj_list, obj_action string) *ForjCli
- func (c *ForjCli) AddActionFlagsFromObjectAction(obj_name, obj_action string) *ForjCli
- func (c *ForjCli) AddActionFlagsFromObjectListActions(obj_name, obj_list string, obj_actions ...string) *ForjCli
- func (c *ForjCli) AddAppFlag(paramIntType, name, help string, options *ForjOpts)
- func (c *ForjCli) AddArg(value_type, name, help string, options *ForjOpts) *ForjCli
- func (c *ForjCli) AddFieldListCapture(key, capture string) error
- func (c *ForjCli) AddFlag(value_type, name, help string, options *ForjOpts) *ForjCli
- func (c *ForjCli) ContextHook(context interface{}) (error, bool)
- func (c *ForjCli) Error() error
- func (c *ForjCli) GetAction(name string) *ForjAction
- func (c *ForjCli) GetActionBoolValue(action_name, paramValue string) (bool, error)
- func (c *ForjCli) GetActionStringValue(action_name, paramValue string) (string, error)
- func (c *ForjCli) GetAllActions() map[string]*ForjAction
- func (c *ForjCli) GetAppBoolValue(paramValue string) (bool, error)
- func (c *ForjCli) GetAppFlag(paramValue string) *ForjFlag
- func (c *ForjCli) GetAppStringValue(paramValue string) (string, error)
- func (c *ForjCli) GetBoolValue(object, key, param_name string) (bool, bool, error)
- func (c *ForjCli) GetCurrentCommand() []clier.CmdClauser
- func (c *ForjCli) GetObject(obj_name string) *ForjObject
- func (c *ForjCli) GetObjectValues(obj_name string) map[string]*ForjData
- func (c *ForjCli) GetParseContext() clier.ParseContexter
- func (c *ForjCli) GetStringValue(object, key, param_name string) (string, bool, bool, error)
- func (c *ForjCli) GetStringValueAddr(name string) *string
- func (c *ForjCli) IsAppValueFound(paramValue string) bool
- func (c *ForjCli) IsObjectList(object, key, obj_name string) bool
- func (c *ForjCli) IsParamFound(param_name string) (found bool)
- func (c *ForjCli) IsParsePhase() bool
- func (c *ForjCli) LoadCli() error
- func (c *ForjCli) LoadPluginData(data *goforjj.YamlPluginComm) error
- func (c *ForjCli) LoadValuesFrom(context clier.ParseContexter)
- func (c *ForjCli) NewActions(name, act_help, compose_help string, for_forjj bool) (r *ForjAction)
- func (c *ForjCli) NewObject(name, desc string, role string) *ForjObject
- func (c *ForjCli) OnActions(actions ...string) *ForjCli
- func (c *ForjCli) Parse(args []string, context interface{}) (cmd string, err error)
- func (c *ForjCli) ParseAfterHook(context_hook func(*ForjCli, interface{}) (error, bool)) *ForjCli
- func (c *ForjCli) ParseBeforeHook(context_hook func(*ForjCli, interface{}) (error, bool)) *ForjCli
- func (c *ForjCli) SetValue(object, instance, atype, attr string, value interface{}) (err error)
- func (c *ForjCli) String() (ret string)
- func (c *ForjCli) WithObjectInstance(object_name, instance_name string) *ForjCli
- type ForjCliContext
- type ForjContextTime
- type ForjData
- type ForjField
- type ForjFlag
- func (a *ForjFlag) Copier() (p ForjParamCopier)
- func (f *ForjFlag) CopyToArg(cmd clier.CmdClauser) *ForjArg
- func (f *ForjFlag) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
- func (f *ForjFlag) Default(value string) ForjParam
- func (*ForjFlag) GetArg() *ForjArg
- func (f *ForjFlag) GetBoolAddr() *bool
- func (f *ForjFlag) GetBoolValue() bool
- func (f *ForjFlag) GetContextValue(context clier.ParseContexter) (interface{}, bool)
- func (f *ForjFlag) GetFlag() *ForjFlag
- func (f *ForjFlag) GetListValues() []ForjData
- func (f *ForjFlag) GetStringAddr() *string
- func (f *ForjFlag) GetStringValue() string
- func (f *ForjFlag) GetValue() interface{}
- func (f *ForjFlag) IsFound() bool
- func (f *ForjFlag) IsFromObject(obj *ForjObject) bool
- func (f *ForjFlag) IsList() bool
- func (f *ForjFlag) Name() string
- func (f *ForjFlag) String() (ret string)
- func (f *ForjFlag) Type() string
- func (f *ForjFlag) UpdateObject() error
- type ForjFlagList
- func (a *ForjFlagList) Copier() (p ForjParamCopier)
- func (a *ForjFlagList) CopyToArg(cmd clier.CmdClauser) *ForjArg
- func (a *ForjFlagList) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
- func (f *ForjFlagList) Default(value string) ForjParam
- func (f *ForjFlagList) GetBoolAddr() *bool
- func (f *ForjFlagList) GetBoolValue() bool
- func (f *ForjFlagList) GetContextValue(context clier.ParseContexter) (interface{}, bool)
- func (a *ForjFlagList) GetFlagClauser() clier.FlagClauser
- func (f *ForjFlagList) GetListValues() []ForjData
- func (f *ForjFlagList) GetStringAddr() *string
- func (f *ForjFlagList) GetStringValue() string
- func (f *ForjFlagList) GetValue() interface{}
- func (f *ForjFlagList) IsFound() bool
- func (f *ForjFlagList) IsFromObject(obj *ForjObject) bool
- func (f *ForjFlagList) IsList() bool
- func (fl *ForjFlagList) Name() string
- func (f *ForjFlagList) String() (ret string)
- func (f *ForjFlagList) Type() string
- type ForjInstanceData
- type ForjKingpinParam
- type ForjListData
- type ForjListParam
- type ForjObject
- func (o *ForjObject) AddArg(name string, options *ForjOpts) *ForjObject
- func (o *ForjObject) AddField(pIntType, name, help, re string, opts *ForjOpts) *ForjObject
- func (o *ForjObject) AddFlag(name string, options *ForjOpts) *ForjObject
- func (o *ForjObject) AddFlagFromObjectListAction(obj_name, obj_list, obj_action string) *ForjObject
- func (o *ForjObject) AddFlagsFromObjectAction(obj_name, obj_action string) *ForjObject
- func (o *ForjObject) AddFlagsFromObjectListActions(obj_name, obj_list string, obj_actions ...string) *ForjObject
- func (o *ForjObject) AddInstanceField(instance, pIntType, name, help, re string, opts *ForjOpts) *ForjObject
- func (o *ForjObject) AddInstances(instances ...string) *ForjObject
- func (o *ForjObject) AddKey(pIntType, name, help, re string, opts *ForjOpts) *ForjObject
- func (o *ForjObject) CreateList(name, list_sep, ext_regexp, help string) *ForjObjectList
- func (o *ForjObject) DefineActions(actions ...string) *ForjObject
- func (o *ForjObject) Error() error
- func (o *ForjObject) GetInstances() []string
- func (o *ForjObject) HasField(field string) (res bool)
- func (o *ForjObject) HasInstanceField(instance, field string) (res bool)
- func (o *ForjObject) HasRole() string
- func (o *ForjObject) IsObjectField(name string) (found bool, has_object_field bool)
- func (o *ForjObject) IsSingle() bool
- func (o *ForjObject) Name() string
- func (o *ForjObject) NoFields() *ForjObject
- func (o *ForjObject) OnActions(list ...string) *ForjObject
- func (o *ForjObject) OnInstance(instance_name string) *ForjObject
- func (o *ForjObject) ParseHook(context_hook func(*ForjObject, *ForjCli, interface{}) (error, bool)) *ForjObject
- func (o *ForjObject) SetParamOptions(param_name string, options *ForjOpts)
- func (o *ForjObject) Single() *ForjObject
- func (o *ForjObject) String() string
- type ForjObjectAction
- type ForjObjectInstance
- type ForjObjectList
- func (l *ForjObjectList) AddActions(actions ...string) *ForjObjectList
- func (l *ForjObjectList) AddFlagsFromObjectAction(obj_name, obj_action string) *ForjObjectList
- func (l *ForjObjectList) AddValidateHandler(valid_handler func(*ForjListData) error) *ForjObjectList
- func (d *ForjObjectList) IsCumulative() bool
- func (l *ForjObjectList) ParseHook(context_hook func(*ForjObjectList, *ForjCli, interface{}) (error, bool)) *ForjObjectList
- func (l *ForjObjectList) Set(value string) error
- func (d *ForjObjectList) String() string
- func (d *ForjObjectList) Stringer() (ret string)
- type ForjObjectListFlags
- type ForjOpts
- func (o *ForjOpts) Default(v string) *ForjOpts
- func (o *ForjOpts) Envar(v string) *ForjOpts
- func (o *ForjOpts) GetDefault(pType string) interface{}
- func (o *ForjOpts) HasEnvar() (bool, string)
- func (o *ForjOpts) IsRequired() bool
- func (o *ForjOpts) MergeWith(fromOpts *ForjOpts)
- func (o *ForjOpts) NoDefault() *ForjOpts
- func (o *ForjOpts) NoEnvar() *ForjOpts
- func (o *ForjOpts) NoShort() *ForjOpts
- func (o *ForjOpts) NotRequired() *ForjOpts
- func (o *ForjOpts) Required() *ForjOpts
- func (o *ForjOpts) Short(b byte) *ForjOpts
- type ForjParam
- type ForjParamCopier
- type ForjRecords
Constants ¶
const ( // Arg : To set a ForjParam as Argument. Arg = "arg" // Flag : To set a ForjParam as Flag. Flag = "flag" )
ForjParams type
const ( // String - Define the Param data type to string. String = "string" // Bool - Define the Param data type to bool. Bool = "bool" // List - Define a ForjObjectList data type. List = "list" )
List of ForjParams internal types
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ForjAction ¶
type ForjAction struct {
// contains filtered or unexported fields
}
ForjActionRef To define an action reference
func (*ForjAction) GetBoolAddr ¶
func (a *ForjAction) GetBoolAddr(param_name string) *bool
func (*ForjAction) GetStringAddr ¶
func (a *ForjAction) GetStringAddr(param_name string) *string
func (*ForjAction) String ¶
func (a *ForjAction) String() string
type ForjArg ¶
type ForjArg struct {
// contains filtered or unexported fields
}
ForjArg defines the flag structure for each object actions
func NewForjArg ¶
func NewForjArg(arg clier.ArgClauser) (f *ForjArg)
NewForjArg creates ForjArg object from a argClauser
func (*ForjArg) Copier ¶
func (a *ForjArg) Copier() (p ForjParamCopier)
func (*ForjArg) CopyToFlag ¶
func (a *ForjArg) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
func (*ForjArg) GetBoolAddr ¶
GetBoolAddr return the address to the bool value. Used in conjunction with Selected Actions AddFlag/AddArg.
func (*ForjArg) GetBoolValue ¶
func (*ForjArg) GetContextValue ¶
func (a *ForjArg) GetContextValue(context clier.ParseContexter) (interface{}, bool)
func (*ForjArg) GetListValues ¶
func (*ForjArg) GetStringAddr ¶
func (*ForjArg) GetStringValue ¶
func (*ForjArg) IsFromObject ¶
func (f *ForjArg) IsFromObject(obj *ForjObject) bool
func (*ForjArg) UpdateObject ¶
type ForjArgList ¶
type ForjArgList struct {
// contains filtered or unexported fields
}
ForjArgList defines the flag list structure for each object actions
func (*ForjArgList) Copier ¶
func (a *ForjArgList) Copier() (p ForjParamCopier)
func (*ForjArgList) CopyToArg ¶
func (a *ForjArgList) CopyToArg(cmd clier.CmdClauser) *ForjArg
func (*ForjArgList) CopyToFlag ¶
func (a *ForjArgList) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
func (*ForjArgList) Default ¶
func (f *ForjArgList) Default(value string) (ret ForjParam)
func (*ForjArgList) GetArgClauser ¶
func (a *ForjArgList) GetArgClauser() clier.ArgClauser
func (*ForjArgList) GetBoolAddr ¶
func (f *ForjArgList) GetBoolAddr() *bool
func (*ForjArgList) GetBoolValue ¶
func (f *ForjArgList) GetBoolValue() bool
func (*ForjArgList) GetContextValue ¶
func (a *ForjArgList) GetContextValue(context clier.ParseContexter) (interface{}, bool)
func (*ForjArgList) GetListValues ¶
func (f *ForjArgList) GetListValues() []ForjListData
func (*ForjArgList) GetStringAddr ¶
func (f *ForjArgList) GetStringAddr() *string
func (*ForjArgList) GetStringValue ¶
func (f *ForjArgList) GetStringValue() string
func (*ForjArgList) GetValue ¶
func (f *ForjArgList) GetValue() interface{}
func (*ForjArgList) IsFound ¶
func (f *ForjArgList) IsFound() bool
func (*ForjArgList) IsFromObject ¶
func (a *ForjArgList) IsFromObject(obj *ForjObject) bool
func (*ForjArgList) IsList ¶
func (f *ForjArgList) IsList() bool
func (*ForjArgList) Name ¶
func (a *ForjArgList) Name() string
func (*ForjArgList) String ¶
func (a *ForjArgList) String() (ret string)
func (*ForjArgList) Type ¶
func (f *ForjArgList) Type() string
type ForjCli ¶
type ForjCli struct { App clier.Applicationer // *kingpin.Application // Kingpin Application object // contains filtered or unexported fields }
ForjCli is the Core cli for forjj command.
func NewForjCli ¶
func NewForjCli(app clier.Applicationer) (c *ForjCli)
NewForjCli : Initialize a new ForjCli object
panic if app is nil.
func (*ForjCli) AddActionFlagFromObjectAction ¶
AddActionFlagFromObjectAction create one flag defined on an object action to selected action.
func (*ForjCli) AddActionFlagFromObjectField ¶
AddActionFlagFromObjectField declare one flag from an object field to selected action. One or more instance flags can be created as soon as object instances are loaded from addInstanceFlags() function.
func (*ForjCli) AddActionFlagFromObjectListAction ¶
AddActionFlagFromObjectListAction add one ObjectList action to the selected list of actions (OnActions).
Ex:<app> update --tests "flag_key" The collection of object flag can be added at parse time. ex: <app> update --tests "key1,key2" --key1-flag <data> --key2-flag <data>
func (*ForjCli) AddActionFlagsFromObjectAction ¶
AddActionFlagsFromObjectAction create all flags defined on an object action to selected action.
func (*ForjCli) AddActionFlagsFromObjectListActions ¶
func (c *ForjCli) AddActionFlagsFromObjectListActions(obj_name, obj_list string, obj_actions ...string) *ForjCli
AddActionFlagsFromObjectListActions add one ObjectList action to the selected list of actions (OnActions). Ex: <app> update --add-tests "flag_key" --remove-tests "test,test2"
func (*ForjCli) AddAppFlag ¶
AddAppFlag create a flag object at the application layer.
func (*ForjCli) AddArg ¶
AddArg Add an arg on selected actions You could get values With 2 different possible functions (where <Type> can be cli.String or cli.Bool) - Get<Type>Value() to get the typed value - Get<Type>Addr() to get the pointer to the value
func (*ForjCli) AddFieldListCapture ¶
AddFieldListCapture Add a Field list capture
func (*ForjCli) AddFlag ¶
AddFlag Add an flag on selected actions You could get values With 2 different possible functions (where <Type> can be cli.String or cli.Bool) - Get<Type>Value() to get the typed value - Get<Type>Addr() to get the pointer to the value
func (*ForjCli) ContextHook ¶
func (*ForjCli) GetAction ¶
func (c *ForjCli) GetAction(name string) *ForjAction
func (*ForjCli) GetActionBoolValue ¶
GetActionStringValue return a string of the parameter (flag/arg) attached to an action. An empty string is returned if:
- the parameter is not found
- a different type
- parameter value is ""
To check if the parameter exist, use IsAppValueFound.
Note that this function works during the parse context.
func (*ForjCli) GetActionStringValue ¶
GetActionStringValue return a string of the parameter (flag/arg) attached to an action. An empty string is returned if:
- the parameter is not found
- a different type
- parameter value is ""
To check if the parameter exist, use IsAppValueFound.
Note that this function works during the parse context.
func (*ForjCli) GetAllActions ¶
func (c *ForjCli) GetAllActions() map[string]*ForjAction
GetAllActions return the list of actions and definitions defined by the application.
func (*ForjCli) GetAppBoolValue ¶
GetAppBoolValue return a bool value of the parameter found at App layer. return false if
- the parameter is not found
- a different type
- parameter value is false
To check if the parameter exist, use IsAppValueFound.
Note that this function works during the parse context.
It returns an error if:
- the parameter has not been defined in the application layer. Missing AddAppFlag.
- If the context is nil. Means no parse has been executed.
func (*ForjCli) GetAppFlag ¶
GetAppFlag return the Application layer flag named paramValue.
func (*ForjCli) GetAppStringValue ¶
GetAppStringValue return a string of the parameter at App layer. An empty string is returned if:
- the parameter is not found
- a different type
- parameter value is ""
To check if the parameter exist, use IsAppValueFound.
Note that this function works during the parse context.
It returns an error if:
- the parameter has not been defined in the application layer. Missing AddAppFlag.
- If the context is nil. Means no parse has been executed.
func (*ForjCli) GetBoolValue ¶
GetBoolValue : Get a Boolean of the parameter from cli.
Get data from object defined. if object == "application", it will get data from the Application layer
func (*ForjCli) GetCurrentCommand ¶
func (c *ForjCli) GetCurrentCommand() []clier.CmdClauser
func (*ForjCli) GetObject ¶
func (c *ForjCli) GetObject(obj_name string) *ForjObject
func (*ForjCli) GetObjectValues ¶
func (*ForjCli) GetParseContext ¶
func (c *ForjCli) GetParseContext() clier.ParseContexter
GetParseContext return the internal parseContext object
func (*ForjCli) GetStringValue ¶
GetStringValue : Get a String of the parameter from cli.
Get data from object defined. if object == "application", it will get data from the Application layer
returns: - value - found - default : If value is a pointer to a string, default is set to true. - error
func (*ForjCli) GetStringValueAddr ¶
GetStringValueAddr : Provide the Address to the flag/argument value if is a *string. It returns nil if the flag/arg was not found or is not a string.
func (*ForjCli) IsAppValueFound ¶
IsAppValueFound return true if the parameter value is found on App Layer
func (*ForjCli) IsObjectList ¶
IsObjectList returns - true if the context is a list and is that object. - true if the action has a ObjectList
func (*ForjCli) IsParamFound ¶
IsParamFound. Search in defined parameter if it exists
func (*ForjCli) IsParsePhase ¶
func (*ForjCli) LoadCli ¶
LoadCli Same as LoadContext. But in final stage
Load all cli data to internal object representative
func (*ForjCli) LoadPluginData ¶
func (c *ForjCli) LoadPluginData(data *goforjj.YamlPluginComm) error
LoadPluginData: Load Plugin Definition in cli.
func (*ForjCli) LoadValuesFrom ¶
func (c *ForjCli) LoadValuesFrom(context clier.ParseContexter)
LoadValuesFrom load most of flags/arguments found in the cli context in values, like kingpin.execute do.
func (*ForjCli) NewActions ¶
func (c *ForjCli) NewActions(name, act_help, compose_help string, for_forjj bool) (r *ForjAction)
NewActions create the list of referenced valid actions supported. kingpin layer created. It add them to the kingpin application layer.
name : Name of the action to add help : Generic help to add to the action. for_forjj: True if the action is protected against plugins features.
func (*ForjCli) NewObject ¶
func (c *ForjCli) NewObject(name, desc string, role string) *ForjObject
NewObjectActions add a new object and the list of actions. It creates the ForjAction object for each action/object couple, to attach the object to kingpin object layer.
func (*ForjCli) ParseAfterHook ¶
ParseAfterHook defines a hook that will be executed after object list and object hooks
func (*ForjCli) ParseBeforeHook ¶
ParseBeforeHook defines a hook that will be executed before object list and object hooks
func (*ForjCli) WithObjectInstance ¶
type ForjCliContext ¶
type ForjCliContext struct {
// contains filtered or unexported fields
}
type ForjContextTime ¶
type ForjContextTime struct {
// contains filtered or unexported fields
}
ForjContextTime. Structure used at context time to add more flags from Objectlist instances or Add Object fields Flags from instances.
type ForjData ¶
type ForjData struct {
// contains filtered or unexported fields
}
type ForjField ¶
type ForjField struct {
// contains filtered or unexported fields
}
type ForjFlag ¶
type ForjFlag struct {
// contains filtered or unexported fields
}
ForjFlag defines the flag structure for each object actions
func NewForjFlag ¶
func NewForjFlag(flag clier.FlagClauser) (f *ForjFlag)
NewForjFlag creates ForjFlag object from a flagClauser
func (*ForjFlag) Copier ¶
func (a *ForjFlag) Copier() (p ForjParamCopier)
func (*ForjFlag) CopyToFlag ¶
func (f *ForjFlag) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
func (*ForjFlag) GetBoolAddr ¶
func (*ForjFlag) GetBoolValue ¶
func (*ForjFlag) GetContextValue ¶
func (f *ForjFlag) GetContextValue(context clier.ParseContexter) (interface{}, bool)
func (*ForjFlag) GetListValues ¶
func (*ForjFlag) GetStringAddr ¶
func (*ForjFlag) GetStringValue ¶
func (*ForjFlag) IsFromObject ¶
func (f *ForjFlag) IsFromObject(obj *ForjObject) bool
func (*ForjFlag) UpdateObject ¶
type ForjFlagList ¶
type ForjFlagList struct {
// contains filtered or unexported fields
}
ForjFlagList defines the flag list structure for each object actions
func (*ForjFlagList) Copier ¶
func (a *ForjFlagList) Copier() (p ForjParamCopier)
func (*ForjFlagList) CopyToArg ¶
func (a *ForjFlagList) CopyToArg(cmd clier.CmdClauser) *ForjArg
func (*ForjFlagList) CopyToFlag ¶
func (a *ForjFlagList) CopyToFlag(cmd clier.CmdClauser) *ForjFlag
func (*ForjFlagList) Default ¶
func (f *ForjFlagList) Default(value string) ForjParam
func (*ForjFlagList) GetBoolAddr ¶
func (f *ForjFlagList) GetBoolAddr() *bool
func (*ForjFlagList) GetBoolValue ¶
func (f *ForjFlagList) GetBoolValue() bool
func (*ForjFlagList) GetContextValue ¶
func (f *ForjFlagList) GetContextValue(context clier.ParseContexter) (interface{}, bool)
func (*ForjFlagList) GetFlagClauser ¶
func (a *ForjFlagList) GetFlagClauser() clier.FlagClauser
func (*ForjFlagList) GetListValues ¶
func (f *ForjFlagList) GetListValues() []ForjData
func (*ForjFlagList) GetStringAddr ¶
func (f *ForjFlagList) GetStringAddr() *string
func (*ForjFlagList) GetStringValue ¶
func (f *ForjFlagList) GetStringValue() string
func (*ForjFlagList) GetValue ¶
func (f *ForjFlagList) GetValue() interface{}
func (*ForjFlagList) IsFound ¶
func (f *ForjFlagList) IsFound() bool
func (*ForjFlagList) IsFromObject ¶
func (f *ForjFlagList) IsFromObject(obj *ForjObject) bool
func (*ForjFlagList) IsList ¶
func (f *ForjFlagList) IsList() bool
func (*ForjFlagList) Name ¶
func (fl *ForjFlagList) Name() string
func (*ForjFlagList) String ¶
func (f *ForjFlagList) String() (ret string)
func (*ForjFlagList) Type ¶
func (f *ForjFlagList) Type() string
type ForjInstanceData ¶
type ForjInstanceData map[string]interface{}
type ForjKingpinParam ¶
type ForjKingpinParam interface {
GetKFlag()
}
type ForjListData ¶
type ForjListParam ¶
type ForjObject ¶
type ForjObject struct {
// contains filtered or unexported fields
}
ForjObject defines the Object structure
func (*ForjObject) AddArg ¶
func (o *ForjObject) AddArg(name string, options *ForjOpts) *ForjObject
func (*ForjObject) AddField ¶
func (o *ForjObject) AddField(pIntType, name, help, re string, opts *ForjOpts) *ForjObject
AddField add a field to the object.
func (*ForjObject) AddFlag ¶
func (o *ForjObject) AddFlag(name string, options *ForjOpts) *ForjObject
AddFlag add a flag on the selected list of actions (OnActions)
func (*ForjObject) AddFlagFromObjectListAction ¶
func (o *ForjObject) AddFlagFromObjectListAction(obj_name, obj_list, obj_action string) *ForjObject
AddFlagFromObjectListAction add flag on the select object selected action (OnActions) from object list actions identified by obj_name, obj_list, []obj_actions. The flag will be named as --<obj_action>-<obj_name>s
- obj_name, obj_list, obj_action identify the list and action to add as flag
- action where flags will be created.
ex: forjj create workspace --repos ...
At context time this object list will create more detailed flags.
return nil if the obj_list is not found. Otherwise, return the object updated.
func (*ForjObject) AddFlagsFromObjectAction ¶
func (o *ForjObject) AddFlagsFromObjectAction(obj_name, obj_action string) *ForjObject
AddFlagsFromObjectAction will add all object action flags to the selected object actions.
func (*ForjObject) AddFlagsFromObjectListActions ¶
func (o *ForjObject) AddFlagsFromObjectListActions(obj_name, obj_list string, obj_actions ...string) *ForjObject
AddFlagsFromObjectListActions add flags on the select object selected action (OnActions) from object list actions identified by obj_name, obj_list, []obj_actions. The flag will be named as --<obj_action>-<obj_name>s
- obj_name, obj_list, obj_action identify the list and action to add as flags
- action where flags will be created.
ex: forjj create --add-repos ...
At context time this object list will create more detailed flags.
return nil if the obj_list is not found. Otherwise, return the object updated.
func (*ForjObject) AddInstanceField ¶
func (o *ForjObject) AddInstanceField(instance, pIntType, name, help, re string, opts *ForjOpts) *ForjObject
AddInstanceField add a field to the object.
func (*ForjObject) AddInstances ¶
func (o *ForjObject) AddInstances(instances ...string) *ForjObject
AddInstanceField add a field to the object.
func (*ForjObject) AddKey ¶
func (o *ForjObject) AddKey(pIntType, name, help, re string, opts *ForjOpts) *ForjObject
AddKey add a Key field to the object.
func (*ForjObject) CreateList ¶
func (o *ForjObject) CreateList(name, list_sep, ext_regexp, help string) *ForjObjectList
CreateList create a new list. It returns the ForjObjectList to set it and configure actions
func (*ForjObject) DefineActions ¶
func (o *ForjObject) DefineActions(actions ...string) *ForjObject
DefineActions add a new object and the list of actions. It creates the ForjAction object for each action/object couple, to attach the object to kingpin object layer.
func (*ForjObject) Error ¶
func (o *ForjObject) Error() error
func (*ForjObject) GetInstances ¶
func (o *ForjObject) GetInstances() []string
func (*ForjObject) HasField ¶
func (o *ForjObject) HasField(field string) (res bool)
HasField return true if the field exists
func (*ForjObject) HasInstanceField ¶
func (o *ForjObject) HasInstanceField(instance, field string) (res bool)
func (*ForjObject) HasRole ¶
func (o *ForjObject) HasRole() string
IsInternal return the object scope, ie internal or not. Defined by the application initialization See NewObject()
func (*ForjObject) IsObjectField ¶
func (o *ForjObject) IsObjectField(name string) (found bool, has_object_field bool)
func (*ForjObject) IsSingle ¶
func (o *ForjObject) IsSingle() bool
func (*ForjObject) Name ¶
func (o *ForjObject) Name() string
func (*ForjObject) NoFields ¶
func (o *ForjObject) NoFields() *ForjObject
NoFields add a Key field to the object.
func (*ForjObject) OnActions ¶
func (o *ForjObject) OnActions(list ...string) *ForjObject
OnActions select several actions from ObjectActions. If list is empty, used the declared object actions.
func (*ForjObject) OnInstance ¶
func (o *ForjObject) OnInstance(instance_name string) *ForjObject
func (*ForjObject) ParseHook ¶
func (o *ForjObject) ParseHook(context_hook func(*ForjObject, *ForjCli, interface{}) (error, bool)) *ForjObject
func (*ForjObject) SetParamOptions ¶
func (o *ForjObject) SetParamOptions(param_name string, options *ForjOpts)
SetParamOptions update flag/arg options anywhere param_name has been defined, except flag/arg list.
func (*ForjObject) Single ¶
func (o *ForjObject) Single() *ForjObject
func (*ForjObject) String ¶
func (o *ForjObject) String() string
type ForjObjectAction ¶
type ForjObjectAction struct {
// contains filtered or unexported fields
}
ForjObjectAction defines the action structure for each object
Ex: forjj create =>repo --flags value ...<=
where repo is a cmd and params store all object flags/args
func (*ForjObjectAction) String ¶
func (a *ForjObjectAction) String() string
type ForjObjectInstance ¶
type ForjObjectInstance struct {
// contains filtered or unexported fields
}
func NewObjectInstance ¶
func NewObjectInstance(name string) *ForjObjectInstance
func (*ForjObjectInstance) String ¶
func (i *ForjObjectInstance) String() string
type ForjObjectList ¶
type ForjObjectList struct {
// contains filtered or unexported fields
}
ForjObjectList defines a list to apply as new Cmd or as flags/args to any other objects/actions
Ex: forjj create =>repos instance1,instance2,... --<instance>-flags value ...<= identified by actions map[string]*ForjObjectAction.
or with ForjObjectListFlags
Ex: forjj create infra =>--repos instance1,instance2,... --<instance>-flags value ...<= identified by flags_list
func (*ForjObjectList) AddActions ¶
func (l *ForjObjectList) AddActions(actions ...string) *ForjObjectList
AddActions Add the list actions. Ex: forjj add repos <blabla>.
`add` must be an existing action `repos` is a new object action with a cmd attached. `<blabla>` is a arg string that must be attached to the new object action.
The new object action is called with the referenced action to add action to. The Cmd is called `object_name` + `s`
The new Argument is called as `object_name` + `s`. In Cmd, it is called `object_name` + `s`
kingpin: The function creates a new command and an attached argument. The argument is managed by ForjObjectList.
It returns the base object. The list key value will be used at context time to add contexted flag prefixed by the key value.
func (*ForjObjectList) AddFlagsFromObjectAction ¶
func (l *ForjObjectList) AddFlagsFromObjectAction(obj_name, obj_action string) *ForjObjectList
func (*ForjObjectList) AddValidateHandler ¶
func (l *ForjObjectList) AddValidateHandler(valid_handler func(*ForjListData) error) *ForjObjectList
func (*ForjObjectList) IsCumulative ¶
func (d *ForjObjectList) IsCumulative() bool
Inform kingpin that flag is cumulative.
func (*ForjObjectList) ParseHook ¶
func (l *ForjObjectList) ParseHook(context_hook func(*ForjObjectList, *ForjCli, interface{}) (error, bool)) *ForjObjectList
func (*ForjObjectList) Set ¶
func (l *ForjObjectList) Set(value string) error
Set function for kingpin.Value interface Accept only one call to Set. The last call win. Each call to this function re-initialize the context/final list
func (*ForjObjectList) String ¶
func (d *ForjObjectList) String() string
func (*ForjObjectList) Stringer ¶
func (d *ForjObjectList) Stringer() (ret string)
Stringer : Set function for kingpin.Value interface
type ForjObjectListFlags ¶
type ForjObjectListFlags struct {
// contains filtered or unexported fields
}
type ForjOpts ¶
type ForjOpts struct {
// contains filtered or unexported fields
}
func (*ForjOpts) GetDefault ¶
GetDefault return the default value from defined options. Used to set single object attribute default value It must return a pointer to a pType value type (*string, *bool, ...)
func (*ForjOpts) IsRequired ¶
func (*ForjOpts) NotRequired ¶
type ForjParam ¶
type ForjParam interface { Name() string String() string Type() string IsFound() bool GetBoolValue() bool GetStringValue() string GetBoolAddr() *bool GetStringAddr() *string GetContextValue(clier.ParseContexter) (interface{}, bool) GetValue() interface{} // Update default Default(string) ForjParam IsList() bool IsFromObject(*ForjObject) bool CopyToFlag(clier.CmdClauser) *ForjFlag CopyToArg(clier.CmdClauser) *ForjArg Copier() ForjParamCopier // contains filtered or unexported methods }
type ForjParamCopier ¶
type ForjParamCopier interface { CopyToFlag(clier.CmdClauser) *ForjFlag CopyToArg(clier.CmdClauser) *ForjArg }
type ForjRecords ¶
type ForjRecords struct {
// contains filtered or unexported fields
}
func (*ForjRecords) Get ¶
func (r *ForjRecords) Get(key, param string) (ret interface{}, found bool, err error)
GetFrom, get the param value from the defined context. If no context exists, it tries to get from App Flag layer It search in action_object and then action. If the value context is a list, it moves to get it from the App layer directly.
func (*ForjRecords) String ¶
func (r *ForjRecords) String() (ret string)