opt

package
v2.0.37+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 0 Imported by: 1

Documentation

Overview

Package opt provides a simple struct for options that can be passed in as an optional last variadic parameter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugOpt

func DebugOpt(opts []*Opt) (result bool)

DebugOpt finds and returns the option's value or a default value if missing

func DefaultDebugOpt

func DefaultDebugOpt(opts *[]*Opt, val bool)

DefaultDebugOpt sets the default for the flag

func DefaultDryRunOpt

func DefaultDryRunOpt(opts *[]*Opt, val bool)

DefaultDryRunOpt sets the default for the flag

func DryRunOpt

func DryRunOpt(opts []*Opt) (result bool)

DryRunOpt finds and returns the option's value or a default value if missing

Types

type Opt

type Opt struct {
	Key string      // name of the option
	Val interface{} // value of the option
}

Opt provides a mechanism for passing in optional options to functions.

func Find

func Find(opts []*Opt, key string) *Opt

Find an option by the given key

func NewDebugOpt

func NewDebugOpt(val bool) *Opt

NewDebugOpt creates the new option with the given value

func NewDryRunOpt

func NewDryRunOpt(val bool) *Opt

NewDryRunOpt creates the new option with the given value

Jump to

Keyboard shortcuts

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