internal

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default = iota // Default
	Testing        // Testing
)

Variables

This section is empty.

Functions

func Usage

func Usage(doc *string) *string

func UsageDefault

func UsageDefault() *string

Types

type AppHelper

type AppHelper struct {
	// contains filtered or unexported fields
}

Helper for exits and errors. mode can be one of Default or Testing.

var App AppHelper

Assigned in main

func (*AppHelper) Errors

func (a *AppHelper) Errors(err error, call func(err error))

Check if an error was generated and run a callback. If err is nil the function returns.

Print a standard error and exit:

a := AppHelper{}
err := errors.New("More cowbell")
a.Errors(err, nil)

Custom code on error:

errcnt := 0
efunc := func(err error) {
  e := fmt.Errorf("Got error: %v", err)
  log.Printf("%v", e)
  errcnt = errcnt + 1
}
err := SomeFunction()
a.Errors(err, efunc)
log.Printf("Error count: %d", errcnt)

func (*AppHelper) Exit

func (a *AppHelper) Exit(code int)

Exit code wrapper. Used for unit testing.

type CliOps

type CliOps struct {
	File      string
	Checktags bool
	Major     bool
	Minor     bool
	Patch     bool
	List      bool
}

func Args

func Args(args []string, doc *string, version string) (*CliOps, error)

type Git

type Git struct {
	// contains filtered or unexported fields
}

func PlainOpen

func PlainOpen(path string) Git

func (*Git) ListTags

func (r *Git) ListTags() []string

Jump to

Keyboard shortcuts

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