cmdcontext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cmdcontext provides the "Context" struct which encapsulates all input values and related objects relevant to every execution of the "runner" command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Out        io.Writer
	VerboseOut io.Writer
	Err        io.Writer
}

Context holds all structs which make up the runtime context of a single execution of the "runner" command. The most commonly-used structs here are the writers:

Out
  The default writer subcommands should use when writing to standard out. This writer
  is unlike any other as it will either ignore requests to write to standard out (by
  default) or will honor them (when the 'verbose' flag is set).
VerboseOut
  The writer subcommands should use when they want to force writing to standard out.
  The 'version' command, for example, would be cumbersome if the 'verbose' flag were
  necessary to generate output. Other commands will at times need to generate a minimum
  level of output.
Err
  The writer to use when generating output related to an error. Note that this writer
  use the operating system's standard error output, instead of standard out.

func (*Context) Init

func (c *Context) Init(verbose bool)

Init will instantiate a new Context object initialized with the state of the 'verbose' flag.

type NoopWriter

type NoopWriter struct{}

NoopWriter is an implementation of the standard Writer which takes no action upon being asked to write.

func (NoopWriter) Write

func (w NoopWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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