command

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ErrInvalidArguments = InvalidArguments("invalid arguments")

ErrInvalidArguments is a simple default for the InvalidArguments type.

Variables

This section is empty.

Functions

func IsInvalidArguments

func IsInvalidArguments(err error) bool

IsInvalidArguments returns a boolean indicating whether the error is of type InvalidArguments, or wraps an error of that type.

Types

type Command

type Command struct {
	// The command name.
	Name string

	// UsageLine is the one-line usage message.
	UsageLine string

	// Short is the short description shown in the 'whatsnew help' output.
	Short string

	// Long is the long message shown in the 'whatsnew help <this-command>'
	// output.
	Long string

	// Run runs the command.
	//
	// The args are the arguments after the command name.
	Run func(ctx context.Context, conf *config.Config, args []string) error
}

A Command is an implementation of a whatsnew command.

type InvalidArguments

type InvalidArguments string

InvalidArguments is an error type generally indicating incorrect or missing arguments or flags.

An error of this type can be returned from Command.Run for telling the caller that the arguments are incorrect.

It is implemented as a simple string, so that a custom message can be easily represented. If no specific message is required, ErrInvalidArguments might provide a convenient default.

func (InvalidArguments) Error

func (err InvalidArguments) Error() string

Error satisfies the error interface. It simply returns the underlying string value.

Jump to

Keyboard shortcuts

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