mirror of https://github.com/k3d-io/k3d
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
699 B
29 lines
699 B
2 years ago
|
package util
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
// IOStreams provides the standard names for iostreams.
|
||
|
// This is useful for embedding and for unit testing.
|
||
|
// Inconsistent and different names make it hard to read and review code
|
||
|
// This is based on https://github.com/kubernetes-sigs/kind/blob/main/pkg/cmd/iostreams.go, but just the nice type without the dependency
|
||
|
type IOStreams struct {
|
||
|
// In think, os.Stdin
|
||
|
In io.Reader
|
||
|
// Out think, os.Stdout
|
||
|
Out io.Writer
|
||
|
// ErrOut think, os.Stderr
|
||
|
ErrOut io.Writer
|
||
|
}
|
||
|
|
||
|
// StandardIOStreams returns an IOStreams from os.Stdin, os.Stdout
|
||
|
func StandardIOStreams() IOStreams {
|
||
|
return IOStreams{
|
||
|
In: os.Stdin,
|
||
|
Out: os.Stdout,
|
||
|
ErrOut: os.Stderr,
|
||
|
}
|
||
|
}
|