Documentation ¶
Index ¶
- Variables
- func New(cfg *Config) *runner
- func NewNopCommand(name string) *nopCommand
- type BashCommand
- type BingCommand
- type Command
- type CommandRequest
- type Config
- type DeleteFileCommand
- type ExitCommand
- type GoogleCommand
- type ListFilesCommand
- type ReadFileCommand
- type WebCommand
- type WriteFileCommand
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrParse = fmt.Errorf("couldn't parse commands")
Functions ¶
func NewNopCommand ¶
func NewNopCommand(name string) *nopCommand
NewNopCommand creates a new nop command with the given name
Types ¶
type BashCommand ¶
type BashCommand struct {
// contains filtered or unexported fields
}
BashCommand executes a bash command
func (*BashCommand) Name ¶
func (c *BashCommand) Name() string
type BingCommand ¶
type BingCommand struct {
// contains filtered or unexported fields
}
BingCommand asks bing chat the given question
func (*BingCommand) Name ¶
func (c *BingCommand) Name() string
type CommandRequest ¶
type CommandRequest struct { // Command name Name string `json:"name"` // Command arguments Args []any `json:"args"` }
CommandRequest represents a single command request
func Parse ¶
func Parse(text string) ([]CommandRequest, error)
Parse tries to parse a JSON array of commands from the given text.
type Config ¶ added in v1.1.0
type Config struct { Exit func() Output string Bing io.ReadWriter GoogleKey string GoogleCX string }
Config represents the configuration for a command runner.
type DeleteFileCommand ¶
type DeleteFileCommand struct {
// contains filtered or unexported fields
}
DeleteFileCommand deletes a file from the output directory
func (*DeleteFileCommand) Name ¶
func (c *DeleteFileCommand) Name() string
type ExitCommand ¶
type ExitCommand struct {
// contains filtered or unexported fields
}
func (*ExitCommand) Name ¶
func (c *ExitCommand) Name() string
type GoogleCommand ¶
type GoogleCommand struct {
// contains filtered or unexported fields
}
func (*GoogleCommand) Name ¶
func (c *GoogleCommand) Name() string
type ListFilesCommand ¶
type ListFilesCommand struct {
// contains filtered or unexported fields
}
ListFilesCommand lists files in the output directory
func (*ListFilesCommand) Name ¶
func (c *ListFilesCommand) Name() string
type ReadFileCommand ¶
type ReadFileCommand struct {
// contains filtered or unexported fields
}
ReadFileCommand reads a file from the output directory
func (*ReadFileCommand) Name ¶
func (c *ReadFileCommand) Name() string
type WebCommand ¶
type WebCommand struct{}
func (*WebCommand) Name ¶
func (c *WebCommand) Name() string
type WriteFileCommand ¶
type WriteFileCommand struct {
// contains filtered or unexported fields
}
WriteFileCommand writes a file to the output directory
func (*WriteFileCommand) Name ¶
func (c *WriteFileCommand) Name() string
Click to show internal directories.
Click to hide internal directories.