Documentation
¶
Overview ¶
Package cmdrs has various built-in implementations of Commander for use in tests and examples.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteString ¶
WriteString writes to the Writer, discarding the returned byte count. The error is always non-nil if the returned count != len(s), so the count isn't interesting if all you care about is error existence. Handy in test assertions, e.g. assert.NoError(t, WriteString(w, "data"))
Types ¶
type HoardingCommander ¶
type HoardingCommander struct {
KondoCommander
// contains filtered or unexported fields
}
HoardingCommander keeps everything it sees. Handy for tests, debugging etc.
func NewHoardingCommander ¶
func NewHoardingCommander(c string) *HoardingCommander
NewHoardingCommander returns a new instance of HoardingCommander.
func (*HoardingCommander) SinkErr ¶
func (c *HoardingCommander) SinkErr() io.Writer
SinkErr accepts stdErr content from a shell.
func (*HoardingCommander) SinkOut ¶
func (c *HoardingCommander) SinkOut() io.Writer
SinkOut accepts stdOut content from a shell.
func (*HoardingCommander) StdErrContent ¶
func (c *HoardingCommander) StdErrContent() []byte
func (*HoardingCommander) StdOutContent ¶
func (c *HoardingCommander) StdOutContent() []byte
type KondoCommander ¶
type KondoCommander struct {
// contains filtered or unexported fields
}
KondoCommander quietly discards everything sent to Write. Use this when you just want to run a command and don't care about the command's output.
func NewKondoCommander ¶
func NewKondoCommander(c string) *KondoCommander
func (*KondoCommander) SinkErr ¶
func (c *KondoCommander) SinkErr() io.Writer
SinkErr accepts stdErr content from a shell.
func (*KondoCommander) SinkOut ¶
func (c *KondoCommander) SinkOut() io.Writer
SinkOut accepts stdOut content from a shell.
type PrintingCommander ¶
type PrintingCommander struct {
KondoCommander
}
PrintingCommander prints everything to os.stdOut and os.stdErr. Only useful for examples, tests, debugging, etc.
func NewPrintingCommander ¶
func NewPrintingCommander(c string) *PrintingCommander
NewPrintingCommander returns a new instance of PrintingCommander.
func (*PrintingCommander) SinkErr ¶
func (c *PrintingCommander) SinkErr() io.Writer
SinkErr accepts stdErr content from a shell.
func (*PrintingCommander) SinkOut ¶
func (c *PrintingCommander) SinkOut() io.Writer
SinkOut accepts stdOut content from a shell.