options

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package options implements command line options and manages application wide data.

Index

Constants

View Source
const (
	OptionErrorNormalExit = iota
	OptionErrorUnexpected
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppOptions

type AppOptions struct {
	VersionInformation *VersionOptions
	HelpInformation    *HelpOptions
	AppName            string
	BuildVersion       string
	BuildDate          string
	BuildOwner1        string
	BuildOwner2        string
	Repository         string
}

AppOptions stores information that is used throughout the application.

func (*AppOptions) Init

func (a *AppOptions) Init() (*AppOptions, error)

Init parses command line options and updates the AppOptions data. Depending on the option, Init either handles it (e.g. --help and --version) or sets its data.

type HelpOptions

type HelpOptions struct {
	Help bool `short:"h" long:"help" description:"Show this help message"`
}

HelpOptions defines the properties of the '-h' or '--help' command line option.

type OptionError

type OptionError struct {
	Err       error
	ErrorCode int
}

OptionError represents an error that occurred while parsing or handling command line options.

func (*OptionError) Error

func (f *OptionError) Error() string

Error returns the error message in OptionError.

type VersionOptions

type VersionOptions struct {
	Version bool `short:"v" long:"version" description:"Print version information"`
}

VersionOptions defines the properties of the '-v' or '--version' command line option.

Jump to

Keyboard shortcuts

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