cmd

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = &commandExt{
	newExtensionPoint(new(Command)),
}
View Source
var (

	// ErrArgument represents error in command argument
	ErrArgument = errors.New("argument error")
)

Functions

func HumanReadableBytes

func HumanReadableBytes(s uint64) string

HumanReadableBytes returns a size string as human-readable format (e.x., 1024 -> 1KB)

func LocalTimeString

func LocalTimeString(t time.Time) string

LocalTimeString returns a formatted date string (2006-01-02 15:04:05)

func OptionUsage

func OptionUsage(f *flag.FlagSet) string

OptionUsage returns usage of command line option.

func Register

func Register(component interface{}, name string) []string

func Run

func Run(e *env.Environment, cmdName string, cmdArgs []string) int

Run dagtools

Types

type Command

type Command interface {
	// Description is a command description
	Description() string
	// Usage returns a command usage
	Usage() string
	// Init a command
	Init(env *env.Environment) error
	// Run a command
	Run(args []string) error
}

Command defines methods for extension point

Jump to

Keyboard shortcuts

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