Documentation ¶
Index ¶
- Constants
- Variables
- type ExecuteCloser
- type Executor
- func (executor *Executor) Close() error
- func (executor *Executor) Dial(ses *config.Session) error
- func (executor *Executor) Execute(w io.Writer, ses *config.Session, commands ...string) error
- func (executor *Executor) Interactive(r io.Reader, w io.Writer, ses *config.Session) error
- func (executor *Executor) NewSession(c *cli.Context) (*config.Session, error)
- func (executor *Executor) Run(arguments []string) error
Constants ¶
const CommandQuit = ":q"
CommandQuit is the command for exit from Interactive mode.
const CommandsResponseSeparator = "--------"
CommandsResponseSeparator is symbols that is written between responses of several commands if more than one command was called.
Variables ¶
var ( // ErrEmptyAddress is returned when executed command without setting address // in single mode. ErrEmptyAddress = errors.New("address is not set: to set address add -a host:port") // ErrEmptyPassword is returned when executed command without setting password // in single mode. ErrEmptyPassword = errors.New("password is not set: to set password add -p password") // ErrCommandEmpty is returned when executed command length equal 0. ErrCommandEmpty = errors.New("command is not set") )
Errors.
Functions ¶
This section is empty.
Types ¶
type ExecuteCloser ¶
ExecuteCloser is the interface that groups Execute and Close methods.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor is a cli commands execute wrapper.
func NewExecutor ¶
NewExecutor creates a new Executor.
func (*Executor) Dial ¶
Dial sends auth request for remote server. Returns en error if address or password is incorrect.
func (*Executor) Execute ¶
Execute sends commands to Execute to the remote server and prints the response.
func (*Executor) Interactive ¶
Interactive reads stdin, parses commands, executes them on remote server and prints the responses.
func (*Executor) NewSession ¶
NewSession parses os args and config file for connection details to a remote server. If the address and password flags were received the configuration file is ignored.