Documentation
¶
Index ¶
- Constants
- type CmdEdit
- type Config
- type Edit
- type ErrConnectionClosed
- type ErrDuplicateMacro
- type ErrEmptyCommand
- type ErrEmptyMacro
- type ErrEmptyRequest
- type ErrInvalidRepeatCommand
- type ErrInvalidTimeout
- type ErrTimeout
- type ErrUnknownCommand
- type ErrUnsupportedMessageType
- type ErrUnsupportedVersion
- type Exit
- type Factory
- type InputFileCommand
- type Macro
- type MacroTemplates
- type PrintMsg
- type RepeatCommand
- type Send
- type Sequence
- type SleepCommand
- type WaitForResp
Constants ¶
const ( PartsNumber = 2 LineUp = "\x1b[1A" LineClear = "\x1b[2K" HideCursor = "\x1b[?25l" ShowCursor = "\x1b[?25h" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdEdit ¶
type CmdEdit struct{}
func NewCmdEdit ¶
func NewCmdEdit() *CmdEdit
NewCmdEdit initializes and returns a new instance of CmdEdit. It does not take any parameters. It returns a pointer to CmdEdit, which can execute an edit command.
type Edit ¶
type Edit struct {
// contains filtered or unexported fields
}
type ErrConnectionClosed ¶
type ErrConnectionClosed struct{}
func (ErrConnectionClosed) Error ¶
func (e ErrConnectionClosed) Error() string
type ErrDuplicateMacro ¶
type ErrDuplicateMacro struct {
MacroName string
}
func (ErrDuplicateMacro) Error ¶
func (e ErrDuplicateMacro) Error() string
type ErrEmptyCommand ¶
type ErrEmptyCommand struct{}
func (ErrEmptyCommand) Error ¶
func (e ErrEmptyCommand) Error() string
type ErrEmptyMacro ¶
type ErrEmptyMacro struct {
MacroName string
}
func (ErrEmptyMacro) Error ¶
func (e ErrEmptyMacro) Error() string
type ErrEmptyRequest ¶
type ErrEmptyRequest struct{}
func (ErrEmptyRequest) Error ¶
func (e ErrEmptyRequest) Error() string
type ErrInvalidRepeatCommand ¶
type ErrInvalidRepeatCommand struct{}
func (ErrInvalidRepeatCommand) Error ¶
func (e ErrInvalidRepeatCommand) Error() string
type ErrInvalidTimeout ¶
type ErrInvalidTimeout struct {
Timeout string
}
func (ErrInvalidTimeout) Error ¶
func (e ErrInvalidTimeout) Error() string
type ErrTimeout ¶
type ErrTimeout struct{}
func (ErrTimeout) Error ¶
func (e ErrTimeout) Error() string
type ErrUnknownCommand ¶
type ErrUnknownCommand struct {
Command string
}
func (ErrUnknownCommand) Error ¶
func (e ErrUnknownCommand) Error() string
type ErrUnsupportedMessageType ¶
type ErrUnsupportedMessageType struct {
MsgType string
}
func (ErrUnsupportedMessageType) Error ¶
func (e ErrUnsupportedMessageType) Error() string
type ErrUnsupportedVersion ¶
type ErrUnsupportedVersion struct {
Version string
}
func (ErrUnsupportedVersion) Error ¶
func (e ErrUnsupportedVersion) Error() string
type Exit ¶
type Exit struct{}
type InputFileCommand ¶
type InputFileCommand struct {
// contains filtered or unexported fields
}
func NewInputFileCommand ¶
func NewInputFileCommand(filePath string) *InputFileCommand
NewInputFileCommand creates a new InputFileCommand instance. It takes filePath of type string, which specifies the path to the input file. It returns a pointer to an InputFileCommand initialized with the given file path.
func (*InputFileCommand) Execute ¶
func (c *InputFileCommand) Execute(exCtx core.ExecutionContext) (core.Executer, error)
Execute executes the InputFileCommand and returns a core.Executer and an error. It reads the file and executes the commands in the file.
type Macro ¶
type Macro struct {
// contains filtered or unexported fields
}
func LoadFromFile ¶
LoadFromFile loads a macro configuration from a file at the given path. It returns a Macro instance and an error if the file cannot be read or parsed.
func LoadMacroForDomain ¶
LoadMacroForDomain loads a macro for a given domain from a directory. It takes the directory path and the domain name as input parameters. It returns a pointer to a Macro struct and an error if any.
func NewMacro ¶
NewMacro creates a new Macro instance with the specified domains. The domains parameter is a slice of strings representing the allowed domains for the macro. Returns a pointer to the newly created Macro instance.
func (*Macro) AddCommands ¶
AddCommands adds a new macro with the given name and commands to the Macro instance. If a macro with the same name already exists, it returns an error. If the rawCommands slice is empty, it returns an error. If the rawCommands slice has only one command, it adds the command directly to the macro. Otherwise, it creates a new Sequence with the commands and adds it to the macro.
type MacroTemplates ¶
type MacroTemplates struct {
// contains filtered or unexported fields
}
func NewMacroTemplates ¶
func NewMacroTemplates(templates []string) (*MacroTemplates, error)
func (*MacroTemplates) GetExecuter ¶
func (t *MacroTemplates) GetExecuter(args []string) (core.Executer, error)
type PrintMsg ¶
type PrintMsg struct {
// contains filtered or unexported fields
}
func NewPrintMsg ¶
NewPrintMsg creates a new PrintMsg instance with the provided core.Message. It takes a msg parameter of type core.Message, representing the message to be printed. It returns a pointer to a PrintMsg struct initialized with the given message.
type RepeatCommand ¶
type RepeatCommand struct {
// contains filtered or unexported fields
}
func NewRepeatCommand ¶
func NewRepeatCommand(times int, subCommand core.Executer) *RepeatCommand
NewRepeatCommand creates a new RepeatCommand to execute a sub-command multiple times. It takes times of type int, which specifies the number of repetitions, and subCommand of type core.Executer to repeat. It returns a pointer to a RepeatCommand initialized with the given subCommand and times.
func (*RepeatCommand) Execute ¶
func (c *RepeatCommand) Execute(exCtx core.ExecutionContext) (core.Executer, error)
Execute executes the RepeatCommand and returns a core.Executer and an error. It executes the sub-command the specified number of times.
type Send ¶
type Send struct {
// contains filtered or unexported fields
}
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
func NewSequence ¶
NewSequence creates a new Sequence containing a list of sub-commands. It takes subCommands, a slice of core.Executer, which represents the commands to be executed in order. It returns a pointer to a Sequence that will execute the sub-commands sequentially.
type SleepCommand ¶
type SleepCommand struct {
// contains filtered or unexported fields
}
func NewSleepCommand ¶
func NewSleepCommand(duration time.Duration) *SleepCommand
NewSleepCommand creates a new SleepCommand that pauses execution for a specified duration. It takes a duration parameter of type time.Duration. It returns a pointer to a SleepCommand instance.
func (*SleepCommand) Execute ¶
func (c *SleepCommand) Execute(_ core.ExecutionContext) (core.Executer, error)
Execute executes the SleepCommand and returns a core.Executer and an error. It sleeps for the specified duration.
type WaitForResp ¶
type WaitForResp struct {
// contains filtered or unexported fields
}
func NewWaitForResp ¶
func NewWaitForResp(timeout time.Duration) *WaitForResp
NewWaitForResp creates a new WaitForResp command with the specified timeout duration. It takes a single parameter timeout of type time.Duration, determining how long to wait for a response. It returns a pointer to a WaitForResp instance.
func (*WaitForResp) Execute ¶
func (c *WaitForResp) Execute(exCtx core.ExecutionContext) (core.Executer, error)
Execute executes the WaitForResp command and waits for a response from the WebSocket connection. If a timeout is set, it will return an error if no response is received within the specified time. If a response is received, it will return a new PrintMsg command with the received message. If the WebSocket connection is closed, it will return an error.