exit

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: Apache-2.0 Imports: 7 Imported by: 22

Documentation

Overview

Package exit contains functions useful for exiting gracefully.

Index

Constants

View Source
const (
	Failure     = 1  // Failure represents a general failure code
	Interrupted = 2  // Ctrl-C (SIGINT)
	BadUsage    = 64 // Usage represents an incorrect command line
	Data        = 65 // Data represents incorrect data supplied by the user
	NoInput     = 66 // NoInput represents that the input file did not exist or was not readable
	Unavailable = 69 // Unavailable represents when a service was unavailable
	Software    = 70 // Software represents an internal software error.
	IO          = 74 // IO represents an I/O error
	Config      = 78 // Config represents an unconfigured or misconfigured state
	Permissions = 77 // Permissions represents a permissions error

	// MaxLogEntries controls the number of log entries to show for each source
	MaxLogEntries = 3
)

Exit codes based on sysexits(3)

Variables

This section is empty.

Functions

func UsageT added in v1.3.0

func UsageT(format string, a ...out.V)

UsageT outputs a templated usage error and exits with error code 64

func WithCodeT added in v1.3.0

func WithCodeT(code int, format string, a ...out.V)

WithCodeT outputs a templated fatal error message and exits with the supplied error code.

func WithError

func WithError(msg string, err error)

WithError outputs an error and exits.

func WithLogEntries added in v1.0.0

func WithLogEntries(msg string, err error, entries map[string][]string)

WithLogEntries outputs an error along with any important log entries, and exits.

func WithProblem added in v1.0.0

func WithProblem(msg string, p *problem.Problem)

WithProblem outputs info related to a known problem and exits.

Types

This section is empty.

Jump to

Keyboard shortcuts

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