internal

package
v0.0.0-...-4cd60ff Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StartupCmd is a command value that is always sent once as the first command.
	StartupCmd = "__internal_startup__"
	// UnsupportedCmd is a command value that is sent when an unsupported command is received.
	UnsupportedCmd = "__internal_unsupported__"
)

Variables

This section is empty.

Functions

func Run

func Run(makeCmds func(LineIO) map[string]CommandSpec)

func RunWithStreams

func RunWithStreams(in io.Reader, out io.Writer, makeCmds func(LineIO) map[string]CommandSpec)

RunWithStreams executes an external special remote with the provided input and output streams.

Types

type CommandSpec

type CommandSpec struct {
	ArgCount int
	Response func(args []string)
}

func Response0

func Response0(f func()) CommandSpec

func Response1

func Response1(f func(s string)) CommandSpec

func Response2

func Response2(f func(s1, s2 string)) CommandSpec

func Response3

func Response3(f func(s1, s2, s3 string)) CommandSpec

func ResponseSplit

func ResponseSplit(f func(s []string)) CommandSpec

type LineIO

type LineIO interface {
	Send(cmd string, args ...interface{})
	Recv() string
}

Jump to

Keyboard shortcuts

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