context

package
v1.3.6-0...-af85d19 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	Args() []string    // Get the list of arguments passed to the program
	Stdin() io.Reader  // Get the standard input stream
	Stdout() io.Writer // Get the standard output stream
	Stderr() io.Writer // Get the error output stream
	Exit(int)          // Exit the program with a specific status code
}

Context interface for handling command-line arguments and standard input/output streams

func New

func New(opts ...Option) Context

New returns a new instance of the Context interface with the standard input, output, and error streams.

type Option

type Option func(ctx *context)

func WithArgs

func WithArgs(args []string) Option

func WithExit

func WithExit(exit func(int)) Option

func WithStderr

func WithStderr(stderr io.Writer) Option

func WithStdin

func WithStdin(stdin io.Reader) Option

func WithStdout

func WithStdout(stdout io.Writer) Option

Jump to

Keyboard shortcuts

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