Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayHelpCmd()
- func DisplayVersion()
- func ExecuteCommand(command string)
- func RemoveFlag(args []string, flagToRemove string) []string
- func RemoveFlagFromPos(args []string, pos int) []string
- func WriteFile(filePath string, content string) error
- type ArgParser
- func (argParser *ArgParser) Debug() *ArgParser
- func (argParser *ArgParser) GetFlagNextVal(flag string) string
- func (argParser *ArgParser) GetFlagPos(flag string) int
- func (argParser *ArgParser) HasFlag(flag string) bool
- func (argParser *ArgParser) RemoveFlag(flag string) bool
- func (argParser *ArgParser) RemoveFlagFromPos(pos int) bool
- type CmdDisplay
Constants ¶
const ( // GroupAPI is the group API scope use in this package GroupAPI = "sxlibs.k8s.startx.fr" // GroupName is the group name use in this package GroupName = "utils" )
const (
// GroupNameArgParser is the group name use in this package
GroupNameArgParser = "utils.args"
)
Variables ¶
var IsDebug bool
The global IsDebug var
Functions ¶
func DisplayHelpCmd ¶
func DisplayHelpCmd()
Function used to display answer to the help command (or flag)
func DisplayVersion ¶
func DisplayVersion()
Function used to display answer to the help command (or flag)
func ExecuteCommand ¶
func ExecuteCommand(command string)
Function used to display the list of quotas
func RemoveFlag ¶
func RemoveFlagFromPos ¶
Types ¶
type ArgParser ¶
type ArgParser struct { SourceArgs []string ParsedArgs []string Binary string TopAction string SubAction string IsHelp bool IsDebug bool }
ArgParser is a definition for displaying message for a command line
func (*ArgParser) GetFlagNextVal ¶
used to scan arguments and detect if command has a special flag
func (*ArgParser) GetFlagPos ¶
used to scan arguments and detect if command has a special flag
func (*ArgParser) RemoveFlag ¶
used to scan arguments and detect if command has a special flag
func (*ArgParser) RemoveFlagFromPos ¶
used to scan arguments and detect if command has a special flag
type CmdDisplay ¶
type CmdDisplay struct {
GroupName string
}
CmdDisplay is a definition for displaying message for a command line
func NewCmdDisplay ¶
func NewCmdDisplay(groupName string) *CmdDisplay
Initialize a CmdDisplay object ex:
display := NewCmdDisplay("main",true)
func (*CmdDisplay) Debug ¶
func (cmdDisplay *CmdDisplay) Debug(msg string)
Function used to display a debug trace if IsDebug is on
func (*CmdDisplay) Error ¶
func (cmdDisplay *CmdDisplay) Error(msg string)
Function used to display an error
func (*CmdDisplay) ExitError ¶
func (cmdDisplay *CmdDisplay) ExitError(msg string, errorCode int)
Function used to display an error and return exit
func (*CmdDisplay) Info ¶
func (cmdDisplay *CmdDisplay) Info(msg string)
Function used to display an information
func (*CmdDisplay) Warning ¶
func (cmdDisplay *CmdDisplay) Warning(msg string)
Function used to display a warning