Documentation ¶
Index ¶
- func CheckAppCmdNode(in *AppCmdNode, depth []string)
- func PrintAppResult(in *AppResult) int
- func PrintHelp(depth_level []string, root *AppCmdNode, render_for *AppCmdNode)
- func RunApp(rootnode *AppCmdNode, pass_data interface{})
- type AdditionalInfo
- type AppCmdNode
- type AppResult
- type GetOptCheckList
- type GetOptCheckListItem
- type GetOptResult
- func (self *GetOptResult) CheckOptResult() []error
- func (self *GetOptResult) DoesHaveNamedRetOptItem(name string) bool
- func (self *GetOptResult) DoesNamedRetOptItemHaveValue(name string) bool
- func (self *GetOptResult) GetAllNamedRetOptItems(name string) []RetOptItem
- func (self *GetOptResult) GetLastNamedRetOptItem(name string) *RetOptItem
- func (self *GetOptResult) GetOptionByName(name string) *GetOptCheckListItem
- func (self *GetOptResult) String() string
- type RetOptItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAppCmdNode ¶
func CheckAppCmdNode(in *AppCmdNode, depth []string)
func PrintAppResult ¶
func PrintHelp ¶
func PrintHelp( depth_level []string, root *AppCmdNode, render_for *AppCmdNode, )
func RunApp ¶
func RunApp( rootnode *AppCmdNode, pass_data interface{}, )
NOTE: this function does not returns: os.Exit is called before the return.
use RunCmd to avoid os.Exit
Types ¶
type AdditionalInfo ¶
type AdditionalInfo struct { OptsAndArgs []string AvailableOptions GetOptCheckList DepthLevel []string Subnode *AppCmdNode Rootnode *AppCmdNode Arg0 string PassData interface{} }
type AppCmdNode ¶
type AppCmdNode struct { Name string ShortDescription string Version string VersionInfo string DevStatus string Description string License string Date string Developers []string URIs []string ManPages []string InfoPages []string SubCmds []*AppCmdNode Callable func( getopt_result *GetOptResult, adds *AdditionalInfo, ) *AppResult AvailableOptions GetOptCheckList CheckArgs bool MinArgs int // -1 == allow 0 arguments MaxArgs int // -1 == no limit to arguments; 0 = no arguments allowed }
type GetOptCheckList ¶
type GetOptCheckList []*GetOptCheckListItem
func (GetOptCheckList) GetByName ¶
func (self GetOptCheckList) GetByName(name string) *GetOptCheckListItem
func (GetOptCheckList) HelpString ¶
func (self GetOptCheckList) HelpString() string
type GetOptCheckListItem ¶
type GetOptCheckListItem struct { /* must be with leading '-' (minuses) and without trailing '=' equals */ Name string /* set this to true if Default value have meaning */ HaveDefault bool /* default value in case if defined without value */ Default string /* put here true, if user MUST set this flag */ IsRequired bool /* insist on value to flag. if this is true, and value not passed to option, then if HaveDefault is true then Default is used as value. */ MustHaveValue bool Description string // this text will be printed beside option on --help parameter }
func (*GetOptCheckListItem) HelpString ¶
func (self *GetOptCheckListItem) HelpString() string
type GetOptResult ¶
type GetOptResult struct { NodeInfo *AppCmdNode Args []string Opts []*RetOptItem }
result after arguments processd
func GetOpt ¶
func GetOpt(args []string) *GetOptResult
NOTE: spaces, around option names, theyr values and arguments are not
stripped. spaces considered to be stripped already by some other lexer
func (*GetOptResult) CheckOptResult ¶
func (self *GetOptResult) CheckOptResult() []error
check result accordingly with AvailableOptions passed to
func (*GetOptResult) DoesHaveNamedRetOptItem ¶
func (self *GetOptResult) DoesHaveNamedRetOptItem(name string) bool
check if option with name 'name' has been supplied
func (*GetOptResult) DoesNamedRetOptItemHaveValue ¶
func (self *GetOptResult) DoesNamedRetOptItemHaveValue(name string) bool
check if option with name 'name' has been supplied and it have some value
func (*GetOptResult) GetAllNamedRetOptItems ¶
func (self *GetOptResult) GetAllNamedRetOptItems(name string) []RetOptItem
return all options with name 'name'
func (*GetOptResult) GetLastNamedRetOptItem ¶
func (self *GetOptResult) GetLastNamedRetOptItem(name string) *RetOptItem
If arguments contained many options with name 'name', then return only last of them
func (*GetOptResult) GetOptionByName ¶
func (self *GetOptResult) GetOptionByName(name string) *GetOptCheckListItem
func (*GetOptResult) String ¶
func (self *GetOptResult) String() string
type RetOptItem ¶
Click to show internal directories.
Click to hide internal directories.