Documentation ¶
Overview ¶
Package cli provides all methods to control command line functions
Index ¶
- Variables
- func Flag(args string) (string, map[string]interface{})
- func GetCMDNames(s interface{}) []string
- func GetOptions(s interface{}, key string) ([]string, []interface{})
- func InitConfig(f string) ([]byte, error)
- func SetConfig(args string, s *Config)
- func SetFlag(flag map[string]interface{}, option string, v interface{}) interface{}
- func SetValue(v reflect.Value, rec string, val interface{}) error
- func ShowConfig(s *Config)
- func UpgradeConfig(cfg *Config)
- func WriteConfig(cfg Config) error
- type Config
- type HPing
- type Ping
- type Readline
- func (r *Readline) AddCompleter(pcItem string, pcSubItems []string)
- func (r *Readline) Close(next chan struct{})
- func (r *Readline) GetPrompt() string
- func (r *Readline) Help()
- func (r *Readline) Next()
- func (r *Readline) Refresh()
- func (r *Readline) RemoveItemCompleter(pcItem string)
- func (r *Readline) Run(cmd chan<- string, next chan struct{})
- func (r *Readline) SetEmacs()
- func (r *Readline) SetPrompt(p string)
- func (r *Readline) SetVim()
- func (r *Readline) UpdateCompleter(pcItem string, pcSubItems []string)
- func (r *Readline) UpdatePromptN(p string, n int)
- type Scan
- type Web
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Flag ¶ added in v0.1.8
Flag parses the command arguments syntax: -flag=x -flag x help
func GetCMDNames ¶ added in v0.2.3
func GetCMDNames(s interface{}) []string
GetCMDNames returns command line names
func GetOptions ¶ added in v0.2.3
GetOptions returns option(s)/value(s) for specific command
func InitConfig ¶ added in v0.2.3
InitConfig creates new config file
func SetConfig ¶ added in v0.2.3
SetConfig handles update option's value
func SetFlag ¶ added in v0.1.8
SetFlag returns command option(s)
func SetValue ¶ added in v0.2.3
SetConfig set optioni's value
Types ¶
type Config ¶ added in v0.2.3
type Config struct { Ping Ping `json:"ping"` Hping HPing `json:"hping"` Web Web `json:"web"` Scan Scan `json:"scan"` }
Config represents configuration
type HPing ¶ added in v0.2.3
type HPing struct { Timeout string `json:"timeout"` Method string `json:"method"` Data string `json:"data"` Count int `json:"count"` }
HPing represents ping command options
type Ping ¶ added in v0.2.3
type Ping struct { Timeout string `json:"timeout"` Interval string `json:"interval"` Count int `json:"count"` }
Ping represents ping command options
type Readline ¶
type Readline struct {
// contains filtered or unexported fields
}
Readline structure
func (*Readline) AddCompleter ¶
AddCompleter updates subitem(s) from a specific main item
func (*Readline) GetPrompt ¶
GetPrompt returns the current prompt string
func (*Readline) RemoveItemCompleter ¶
RemoveItemCompleter removes subitem(s) from a specific main item
func (*Readline) Run ¶
Run the main loop
func (*Readline) SetPrompt ¶
SetPrompt set readline prompt and store it
func (*Readline) UpdateCompleter ¶
UpdateCompleter updates subitem(s) from a specific main item