extflag

package
v0.0.0-...-69909db Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllClause

type AllClause interface {
	Required() AllClause
	HiddenPath() AllClause
	HiddenContent() AllClause
	DefaultPath(values string) PathOrContentClause
	DefaultContent(values string) PathOrContentClause
	PathOrContentClause
}

func Flag

func Flag(cmd FlagClause, flagName string, help string) AllClause

type Clause

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

Clause is a fluid interface used to build extended flags. This is useful for flags that are a bit of uncommon logic extension like fileOrContent.

func (*Clause) DefaultContent

func (f *Clause) DefaultContent(value string) PathOrContentClause

func (*Clause) DefaultPath

func (f *Clause) DefaultPath(value string) PathOrContentClause

func (*Clause) HiddenContent

func (f *Clause) HiddenContent() AllClause

HiddenContent hides a flag from usage but still allows it to be used.

func (*Clause) HiddenPath

func (f *Clause) HiddenPath() AllClause

HiddenPath hides a -file flag from usage but still allows it to be used.

func (*Clause) PathOrContent

func (f *Clause) PathOrContent() *PathOrContent

func (*Clause) Required

func (f *Clause) Required() AllClause

Required makes the flag required. You can not provide a Default() value to a Required() flag.

type FlagClause

type FlagClause interface {
	Flag(name, help string) *kingpin.FlagClause
}

func HiddenCmdClause

func HiddenCmdClause(c FlagClause) FlagClause

HiddenCmdClause returns FlagClause that hides created flags.

type PathOrContent

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

PathOrContent is a flag type that defines two flags to fetch bytes. Either from file (*-file flag) or content (* flag).

func (*PathOrContent) Content

func (p *PathOrContent) Content() ([]byte, error)

Content returns content of the file. Flag that specifies path has priority. It returns error if the content is empty and required flag is set to true.

type PathOrContentClause

type PathOrContentClause interface {
	PathOrContent() *PathOrContent
}

Jump to

Keyboard shortcuts

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