app

package
v0.0.0-...-474d2f3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelOnSignal

func CancelOnSignal(ctx context.Context, signals ...os.Signal) (context.Context, context.CancelFunc)

func NewNopWriterCloser

func NewNopWriterCloser(w io.Writer) (io.WriteCloser, error)

Types

type App

type App struct {
	context.Context
	afero.Fs
	platformsh.Environment

	Exit   func(int)
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

func New

func New(ctx context.Context) (*App, context.CancelFunc)

func (*App) Append

func (a *App) Append(s string) (io.WriteCloser, error)

func (*App) Execute

func (a *App) Execute(cfg Config)

func (*App) GetInput

func (a *App) GetInput(s string) (io.ReadCloser, error)

func (*App) GetOutput

func (a *App) GetOutput(s string) (io.WriteCloser, error)

func (*App) LogMemory

func (a *App) LogMemory()

func (*App) Logger

func (a *App) Logger(prefix string) LogLogger

func (*App) ReadYAML

func (a *App) ReadYAML(path string, data interface{}) error

func (*App) SetPrefix

func (a *App) SetPrefix(s string)

type Config

type Config interface {
	Use() string
	Args(cmd *cobra.Command, args []string) error
}

type LogLogger

type LogLogger interface {
	Output(calldepth int, s string) error
}

type MasterRunner

type MasterRunner interface {
	Config
	SubCommands() []Config
}

type NopWriterCloser

type NopWriterCloser struct {
	io.Writer
}

func (NopWriterCloser) Close

func (NopWriterCloser) Close() error

type PostRunner

type PostRunner interface {
	Config
	PostRun(cmd *cobra.Command, args []string) error
}

type PreRunner

type PreRunner interface {
	Config
	PreRun(cmd *cobra.Command, args []string) error
}

type RootRunner

type RootRunner interface {
	MasterRunner
	PersistentPreRun(cmd *cobra.Command, args []string) error
	PersistentPostRun(cmd *cobra.Command, args []string) error
}

type Runner

type Runner interface {
	Config
	Run(cmd *cobra.Command, args []string) error
}

Jump to

Keyboard shortcuts

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