Documentation ¶
Overview ¶
Package mainer defines types relevant to command entrypoint implementation. A typical main entrypoint looks like this, assuming cmd is a struct which defines the command's flags and implements mainer.Mainer:
func main() { var c cmd os.Exit(int(c.Main(os.Args, mainer.CurrentStdio()))) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mainer ¶
Mainer defines the method to implement for a type that implements a Main entrypoint of a command.
type MockMainer ¶
MockMainer is a test mock for the Mainer interface.
type Stdio ¶
type Stdio struct { // Cwd is the current working directory. Cwd string // Stdin is the standard input reader. Stdin io.Reader // Stdout is the standard output writer. Stdout io.Writer // Stderr is the standard error writer. Stderr io.Writer }
Stdio defines the OS abstraction for standard I/O.
func CurrentStdio ¶
func CurrentStdio() Stdio
CurrentStdio returns the Stdio for the current process. Its Cwd field reflects the working directory at the time of the call.
Click to show internal directories.
Click to hide internal directories.