command

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2017 License: Apache-2.0 Imports: 4 Imported by: 17

Documentation

Overview

Package command contains the basic definitions of a command for the command line tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Run runs the command. The args are the arguments after the command name.
	// Run returns the exit code to be used.
	Run func(ctx context.Context, args []string) int

	// UsageLine is the one-line usage message.
	// The first word in the line is taken to be the command name.
	UsageLine string

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

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

Command is an implementation of a BadWolf command. It is model after the go tool (https://github.com/golang/go/tree/master/src/cmd/go).

func (*Command) Name

func (c *Command) Name() string

Name returns the command's name: the first word in the usage line.

func (*Command) Runnable

func (c *Command) Runnable() bool

Runnable reports whether the command can be run; otherwise it is a documentation pseudo-command such as importpath.

func (*Command) Usage

func (c *Command) Usage() int

Usage prints the command usage.

func (*Command) UsageString added in v0.3.0

func (c *Command) UsageString() string

UsageString returns the command usage string..

Jump to

Keyboard shortcuts

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