command

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvToken = "PD_SERVICE_KEY"

	EnvDebug = "DUTYME_DEBUG"
	EnvTrace = "DUTYME_TRACE"
)
View Source
const (
	ExitCodeOK = iota
	ExitCodeError
)
View Source
const (
	// DefaultWorkingTime is default duration of override.
	DefaultWorkingTime = 1 * time.Hour

	// TimeFmt is used for displaying time
	TimeFmt = "2006-01-02 15:04:05-0700"
)
View Source
const (
	DefaultConfigName = ".dutyme.json"
)

Variables

View Source
var (
	Debug bool
	Trace bool
)

Functions

func Debugf

func Debugf(format string, args ...interface{})

Debugf prints debug information when debug env var has non-empty value. If not, it does nothing.

func IsCancel

func IsCancel(err error) bool

func TracePrint

func TracePrint(w io.Writer, err error)

Trace prints pkg/errors stack trace information when trace env var has non-empty value. If not, it does nothing.

Types

type Meta

type Meta struct {
	OutStream io.Writer
	ErrStream io.Writer

	UI *input.UI
}

Meta contain the meta-option that nearly all subcommand inherited.

func (*Meta) AskToken

func (m *Meta) AskToken() (string, error)

func (*Meta) ConfigPath

func (m *Meta) ConfigPath() (string, error)

func (*Meta) NewFlagSet

func (m *Meta) NewFlagSet(name, usage string) *flag.FlagSet

type StartCommand

type StartCommand struct {
	Meta
}

func (*StartCommand) Help

func (c *StartCommand) Help() string

func (*StartCommand) Run

func (c *StartCommand) Run(args []string) int

func (*StartCommand) Synopsis

func (c *StartCommand) Synopsis() string

type VersionCommand

type VersionCommand struct {
	Meta

	Name     string
	Version  string
	Revision string
}

func (*VersionCommand) Help

func (c *VersionCommand) Help() string

func (*VersionCommand) Run

func (c *VersionCommand) Run(args []string) int

func (*VersionCommand) Synopsis

func (c *VersionCommand) Synopsis() string

Jump to

Keyboard shortcuts

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