cli

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2018 License: MIT Imports: 6 Imported by: 20

Documentation

Index

Constants

View Source
const (
	// DateOnlyLayout allows you to define a timestamp using a date only,
	// where GMT is assumed as the timezone: DD/MM/YYYY TZN
	DateOnlyLayout = "02/01/2006 MST"
)

Variables

This section is empty.

Functions

func EncodingTypeFlagDescription added in v1.0.6

func EncodingTypeFlagDescription(mask EncodingType) string

EncodingTypeFlagDescription returns a description for an encoding type flag, optionally given an encoding type mask (0 means all encoding types are allowed).

Types

type EncodingType added in v1.0.6

type EncodingType uint8

EncodingType defines an enum, to represent all encoding options.

const (
	// EncodingTypeHuman encodes the output in a human-optimized format,
	// a format which can chance at any point and should be used only
	// for human readers.
	EncodingTypeHuman EncodingType = 1 << iota
	// EncodingTypeJSON encodes the output as a minified JSON string,
	// and has a format which is promised to be backwards-compatible,
	// to be used for automation purposes.
	EncodingTypeJSON
	// EncodingTypeHex encodes the output using the internal binary encoder,
	// and encoding that binary output using the std hex encoder,
	// resulting in a hex-encoded string.
	EncodingTypeHex
)

type EncodingTypeFlag added in v1.0.6

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

EncodingTypeFlag is a utility flag which can be used to expose an encoding type as an optionally masked flag.

func NewEncodingTypeFlag added in v1.0.6

func NewEncodingTypeFlag(def EncodingType, ref *EncodingType, mask EncodingType) EncodingTypeFlag

NewEncodingTypeFlag returns a new EncodingTypeFlag, referencing an encoding type value, defaulting it to a default value, and optionally allowing you to mask

func (EncodingTypeFlag) Set added in v1.0.6

func (e EncodingTypeFlag) Set(s string) error

Set implements pflag.Value.Set, only the options as defind by the mask are allowed, and the given string is interpreted in a case insensitive manner.

func (EncodingTypeFlag) String added in v1.0.6

func (e EncodingTypeFlag) String() string

String implements pflag.Value.String, returning the selected enum option as a lower-case string.

func (EncodingTypeFlag) Type added in v1.0.6

func (e EncodingTypeFlag) Type() string

Type implements pflag.Value.Type

type LockTimeFlag

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

LockTimeFlag defines LockTime as a flag, as to give the user several ways to define the lock time, such that for example the user isn't required to define it in unix epoch time.

func (*LockTimeFlag) LockTime

func (f *LockTimeFlag) LockTime() uint64

LockTime returns the internal lock time of this LockTime flag

func (*LockTimeFlag) Set

func (f *LockTimeFlag) Set(s string) error

Set implements pflag.Value.Set, which parses the given string either as a timestamp in DateOnlyLayout or RFC822 layout, a duration or as an uint64.

func (*LockTimeFlag) String

func (f *LockTimeFlag) String() string

String implements pflag.Value.String, printing this LockTime either as a timestamp in DateOnlyLayout or RFC822 layout, a duration or as an uint64.

func (*LockTimeFlag) Type

func (f *LockTimeFlag) Type() string

Type implements pflag.Value.Type

type StringLoader added in v1.0.6

type StringLoader interface {
	LoadString(string) error
	String() string
}

StringLoader defines the interface of a type (t), which can be loaded from a string, as well as being turned back into a string, such that `t.LoadString(str) == nil && t.String() == str`.

type StringLoaderFlag added in v1.0.6

type StringLoaderFlag struct {
	StringLoader
}

StringLoaderFlag defines a utility type, allowing any StringLoader to be turned into a pflag-interface compatible type.

func (StringLoaderFlag) Set added in v1.0.6

func (s StringLoaderFlag) Set(str string) error

Set implements pflag.Value.Set, which parses the string using the StringLoader's LoadString method.

func (StringLoaderFlag) Type added in v1.0.6

func (s StringLoaderFlag) Type() string

Type implements pflag.Value.Type

Jump to

Keyboard shortcuts

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