command

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Languages = map[string]string{
	"ar":      "Arabic",
	"cn":      "Chinese",
	"de":      "German",
	"en":      "English",
	"fr":      "French",
	"hi":      "Hindi",
	"ja":      "Japanese",
	"jp":      "Japanese",
	"pt":      "Portuguese",
	"ru":      "Russian",
	"spa":     "Spanish",
	"es":      "Spanish",
	"zh-hant": "Traditional Chinese",
	"zh-tw":   "Traditional Chinese",
	"zh":      "Chinese",
}

https://en.wikipedia.org/wiki/IETF_language_tag

Functions

func ExecShell

func ExecShell(command string)

Types

type Code

type Code struct {
	// contains filtered or unexported fields
}

func (*Code) Finish

func (*Code) Finish()

func (*Code) Handle

func (c *Code) Handle(reply string)

Handle copy code in the reply to clipboard, and return the original reply

func (*Code) Help

func (c *Code) Help() string

func (*Code) Init

func (*Code) Init(input string) string

func (*Code) IsFinished

func (*Code) IsFinished() bool

func (*Code) Name

func (c *Code) Name() string

func (*Code) Prompt

func (*Code) Prompt(p string) string

func (*Code) Prompts

func (c *Code) Prompts(input string) []string

Prompts expand input like "{lang} {question}" to code generation prompts

type Command

type Command interface {
	Name() string
	Help() string
	Init(string) string      // initialize command by input
	Prompts(string) []string // return optional ChatGPT prompts

	Handle(string) // handle reply

	IsFinished() bool // multiple commands mode
	Finish()          // multiple commands mode, clean up

	Prompt(string) string // set custom terminal prompt
}

func Dummy

func Dummy() Command

Dummy return the dummy command

func Parse

func Parse(input string) (cmd Command, prompts []string)

Parse parse slash command in input and generate prompts for ChatGPT

type DB

type DB struct {
	// contains filtered or unexported fields
}

func (*DB) ExecSQL

func (c *DB) ExecSQL(sql string) error

func (*DB) Finish

func (c *DB) Finish()

func (*DB) Handle

func (c *DB) Handle(reply string)

Handle execute SQL

func (*DB) Help

func (c *DB) Help() string

func (*DB) Init

func (c *DB) Init(input string) string

Init...

func (*DB) IsFinished

func (c *DB) IsFinished() bool

func (*DB) Name

func (c *DB) Name() string

func (*DB) Prompt

func (c *DB) Prompt(p string) string

Prompt set terminal prompt for ssh command

func (*DB) Prompts

func (c *DB) Prompts(input string) []string

type Help

type Help struct {
	// contains filtered or unexported fields
}

func (*Help) Finish

func (*Help) Finish()

func (*Help) Handle

func (*Help) Handle(reply string)

func (*Help) Help

func (c *Help) Help() string

func (*Help) Init

func (c *Help) Init(input string) string

func (*Help) IsFinished

func (*Help) IsFinished() bool

func (*Help) Name

func (c *Help) Name() string

func (*Help) Prompt

func (*Help) Prompt(p string) string

func (*Help) Prompts

func (*Help) Prompts(input string) []string

type Shell

type Shell struct {
	// contains filtered or unexported fields
}

func (*Shell) Finish

func (*Shell) Finish()

func (*Shell) Handle

func (c *Shell) Handle(reply string)

Handle execute shell command

func (*Shell) Help

func (c *Shell) Help() string

func (*Shell) Init

func (*Shell) Init(input string) string

func (*Shell) IsFinished

func (*Shell) IsFinished() bool

func (*Shell) Name

func (c *Shell) Name() string

func (*Shell) Prompt

func (*Shell) Prompt(p string) string

func (*Shell) Prompts

func (c *Shell) Prompts(input string) []string

Prompts expand input like "{lang} {question}" to Shell generation prompts

type Ssh

type Ssh struct {
	// contains filtered or unexported fields
}

func (*Ssh) Finish

func (c *Ssh) Finish()

func (*Ssh) Handle

func (c *Ssh) Handle(reply string)

Handle execute command on c.host

func (*Ssh) Help

func (c *Ssh) Help() string

func (*Ssh) Init

func (c *Ssh) Init(input string) string

Init...

func (*Ssh) IsFinished

func (c *Ssh) IsFinished() bool

func (*Ssh) Name

func (c *Ssh) Name() string

func (*Ssh) Prompt

func (c *Ssh) Prompt(p string) string

Prompt set terminal prompt for ssh command

func (*Ssh) Prompts

func (c *Ssh) Prompts(input string) []string

type Summary added in v0.2.1

type Summary struct {
	// contains filtered or unexported fields
}

func (*Summary) Finish added in v0.2.1

func (*Summary) Finish()

func (*Summary) Handle added in v0.2.1

func (*Summary) Handle(reply string)

func (*Summary) Help added in v0.2.1

func (c *Summary) Help() string

func (*Summary) Init added in v0.2.1

func (*Summary) Init(input string) string

func (*Summary) IsFinished added in v0.2.1

func (*Summary) IsFinished() bool

func (*Summary) Name added in v0.2.1

func (c *Summary) Name() string

func (*Summary) Prompt added in v0.2.1

func (*Summary) Prompt(p string) string

func (*Summary) Prompts added in v0.2.1

func (c *Summary) Prompts(input string) []string

Prompts expand input like "{lang} {question}" to Summary generation prompts

type TLDR

type TLDR struct {
	// contains filtered or unexported fields
}

func (*TLDR) Finish

func (*TLDR) Finish()

func (*TLDR) Handle

func (*TLDR) Handle(reply string)

func (*TLDR) Help

func (c *TLDR) Help() string

func (*TLDR) Init

func (*TLDR) Init(input string) string

func (*TLDR) IsFinished

func (*TLDR) IsFinished() bool

func (*TLDR) Name

func (c *TLDR) Name() string

func (*TLDR) Prompt

func (*TLDR) Prompt(p string) string

func (*TLDR) Prompts

func (c *TLDR) Prompts(input string) []string

Prompts generate tldr prompt

type Trans

type Trans struct {
	// contains filtered or unexported fields
}

func (*Trans) Finish

func (*Trans) Finish()

func (*Trans) Handle

func (*Trans) Handle(reply string)

func (*Trans) Help

func (c *Trans) Help() string

func (*Trans) Init

func (*Trans) Init(input string) string

func (*Trans) IsFinished

func (*Trans) IsFinished() bool

func (*Trans) Name

func (c *Trans) Name() string

func (*Trans) Prompt

func (*Trans) Prompt(p string) string

func (*Trans) Prompts

func (c *Trans) Prompts(input string) []string

Run expand input like "{lang} {question}" to code generation prompts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL