Documentation ¶
Overview ¶
Package terminal provides REPLConfig.
Index ¶
- Variables
- type REPLConfig
- type REPLProcess
- func (repl *REPLProcess) Cleanup() (killed bool)
- func (repl *REPLProcess) Init(ctx context.Context, detector logging.MemoryLeakDetector, isPty bool) error
- func (repl *REPLProcess) Start(detector logging.MemoryLeakDetector, Term string, ...) (*os.File, error)
- func (repl *REPLProcess) String() string
- func (repl *REPLProcess) Wait(detector logging.MemoryLeakDetector) (code int, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultREPL = func(ctx context.Context, w io.Writer, input string) (exit bool, code int) {
return input == "exit", 0
}
DefaultREPL is the default function that a REPLConfig uses when the user does not provide one.
It exits unless the user types the word 'exit'.
Functions ¶
This section is empty.
Types ¶
type REPLConfig ¶
type REPLConfig struct { WelcomeMessage string Prompt string Loop func(ctx context.Context, term io.Writer, input string) (exit bool, code int) }
REPLConfig implements a configuration that does not provide any shell access.
func (*REPLConfig) RegisterFlags ¶
func (r *REPLConfig) RegisterFlags(flagset *flag.FlagSet)
RegisterFlags registers flags representing the config to the provided flagset. When flagset is nil, uses flag.CommandLine.
type REPLProcess ¶
type REPLProcess struct { WelcomeMessage string Prompt string Loop func(ctx context.Context, w io.Writer, read string) (exit bool, code int) term.Pipes // contains filtered or unexported fields }
REPLProcess represents a process that is run using a the shell on the current machine
func (*REPLProcess) Cleanup ¶
func (repl *REPLProcess) Cleanup() (killed bool)
Cleanup cleans up this process
func (*REPLProcess) Init ¶
func (repl *REPLProcess) Init(ctx context.Context, detector logging.MemoryLeakDetector, isPty bool) error
Init initializes this process.
func (*REPLProcess) Start ¶
func (repl *REPLProcess) Start(detector logging.MemoryLeakDetector, Term string, resizeChan <-chan proxyssh.WindowSize, isPty bool) (*os.File, error)
Start starts this process
func (*REPLProcess) String ¶
func (repl *REPLProcess) String() string
String turns REPLProcess into a string
func (*REPLProcess) Wait ¶
func (repl *REPLProcess) Wait(detector logging.MemoryLeakDetector) (code int, err error)
Wait waits for the process and returns the exit code.
Click to show internal directories.
Click to hide internal directories.