cli: github.com/urfave/cli/altsrc Index | Files

package altsrc

import "github.com/urfave/cli/altsrc"

Index

Package Files

flag.go flag_generated.go input_source_context.go json_source_context.go map_input_source.go toml_file_loader.go yaml_file_loader.go

func ApplyInputSourceValues Uses

func ApplyInputSourceValues(context *cli.Context, inputSourceContext InputSourceContext, flags []cli.Flag) error

ApplyInputSourceValues iterates over all provided flags and executes ApplyInputSourceValue on flags implementing the FlagInputSourceExtension interface to initialize these flags to an alternate input source.

func InitInputSource Uses

func InitInputSource(flags []cli.Flag, createInputSource func() (InputSourceContext, error)) cli.BeforeFunc

InitInputSource is used to to setup an InputSourceContext on a cli.Command Before method. It will create a new input source based on the func provided. If there is no error it will then apply the new input source to any flags that are supported by the input source

func InitInputSourceWithContext Uses

func InitInputSourceWithContext(flags []cli.Flag, createInputSource func(context *cli.Context) (InputSourceContext, error)) cli.BeforeFunc

InitInputSourceWithContext is used to to setup an InputSourceContext on a cli.Command Before method. It will create a new input source based on the func provided with potentially using existing cli.Context values to initialize itself. If there is no error it will then apply the new input source to any flags that are supported by the input source

func NewJSONSourceFromFlagFunc Uses

func NewJSONSourceFromFlagFunc(flag string) func(c *cli.Context) (InputSourceContext, error)

NewJSONSourceFromFlagFunc returns a func that takes a cli.Context and returns an InputSourceContext suitable for retrieving config variables from a file containing JSON data with the file name defined by the given flag.

func NewTomlSourceFromFlagFunc Uses

func NewTomlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error)

NewTomlSourceFromFlagFunc creates a new TOML InputSourceContext from a provided flag name and source context.

func NewYamlSourceFromFlagFunc Uses

func NewYamlSourceFromFlagFunc(flagFileName string) func(context *cli.Context) (InputSourceContext, error)

NewYamlSourceFromFlagFunc creates a new Yaml InputSourceContext from a provided flag name and source context.

type BoolFlag Uses

type BoolFlag struct {
    cli.BoolFlag
    // contains filtered or unexported fields
}

BoolFlag is the flag type that wraps cli.BoolFlag to allow for other values to be specified

func NewBoolFlag Uses

func NewBoolFlag(fl cli.BoolFlag) *BoolFlag

NewBoolFlag creates a new BoolFlag

func (*BoolFlag) Apply Uses

func (f *BoolFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped BoolFlag.Apply

func (*BoolFlag) ApplyInputSourceValue Uses

func (f *BoolFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a Bool value to the flagSet if required

func (*BoolFlag) ApplyWithError Uses

func (f *BoolFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped BoolFlag.ApplyWithError

type BoolTFlag Uses

type BoolTFlag struct {
    cli.BoolTFlag
    // contains filtered or unexported fields
}

BoolTFlag is the flag type that wraps cli.BoolTFlag to allow for other values to be specified

func NewBoolTFlag Uses

func NewBoolTFlag(fl cli.BoolTFlag) *BoolTFlag

NewBoolTFlag creates a new BoolTFlag

func (*BoolTFlag) Apply Uses

func (f *BoolTFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped BoolTFlag.Apply

func (*BoolTFlag) ApplyInputSourceValue Uses

func (f *BoolTFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a BoolT value to the flagSet if required

func (*BoolTFlag) ApplyWithError Uses

func (f *BoolTFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped BoolTFlag.ApplyWithError

type DurationFlag Uses

type DurationFlag struct {
    cli.DurationFlag
    // contains filtered or unexported fields
}

DurationFlag is the flag type that wraps cli.DurationFlag to allow for other values to be specified

func NewDurationFlag Uses

func NewDurationFlag(fl cli.DurationFlag) *DurationFlag

NewDurationFlag creates a new DurationFlag

func (*DurationFlag) Apply Uses

func (f *DurationFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped DurationFlag.Apply

func (*DurationFlag) ApplyInputSourceValue Uses

func (f *DurationFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a Duration value to the flagSet if required

func (*DurationFlag) ApplyWithError Uses

func (f *DurationFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped DurationFlag.ApplyWithError

type FlagInputSourceExtension Uses

type FlagInputSourceExtension interface {
    cli.Flag
    ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error
}

FlagInputSourceExtension is an extension interface of cli.Flag that allows a value to be set on the existing parsed flags.

type Float64Flag Uses

type Float64Flag struct {
    cli.Float64Flag
    // contains filtered or unexported fields
}

Float64Flag is the flag type that wraps cli.Float64Flag to allow for other values to be specified

func NewFloat64Flag Uses

func NewFloat64Flag(fl cli.Float64Flag) *Float64Flag

NewFloat64Flag creates a new Float64Flag

func (*Float64Flag) Apply Uses

func (f *Float64Flag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped Float64Flag.Apply

func (*Float64Flag) ApplyInputSourceValue Uses

func (f *Float64Flag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a Float64 value to the flagSet if required

func (*Float64Flag) ApplyWithError Uses

func (f *Float64Flag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped Float64Flag.ApplyWithError

type GenericFlag Uses

type GenericFlag struct {
    cli.GenericFlag
    // contains filtered or unexported fields
}

GenericFlag is the flag type that wraps cli.GenericFlag to allow for other values to be specified

func NewGenericFlag Uses

func NewGenericFlag(fl cli.GenericFlag) *GenericFlag

NewGenericFlag creates a new GenericFlag

func (*GenericFlag) Apply Uses

func (f *GenericFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped GenericFlag.Apply

func (*GenericFlag) ApplyInputSourceValue Uses

func (f *GenericFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a generic value to the flagSet if required

func (*GenericFlag) ApplyWithError Uses

func (f *GenericFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped GenericFlag.ApplyWithError

type InputSourceContext Uses

type InputSourceContext interface {
    Int(name string) (int, error)
    Duration(name string) (time.Duration, error)
    Float64(name string) (float64, error)
    String(name string) (string, error)
    StringSlice(name string) ([]string, error)
    IntSlice(name string) ([]int, error)
    Generic(name string) (cli.Generic, error)
    Bool(name string) (bool, error)
    BoolT(name string) (bool, error)
}

InputSourceContext is an interface used to allow other input sources to be implemented as needed.

func NewJSONSource Uses

func NewJSONSource(data []byte) (InputSourceContext, error)

NewJSONSource returns an InputSourceContext suitable for retrieving config variables from raw JSON data.

func NewJSONSourceFromFile Uses

func NewJSONSourceFromFile(f string) (InputSourceContext, error)

NewJSONSourceFromFile returns an InputSourceContext suitable for retrieving config variables from a file (or url) containing JSON data.

func NewJSONSourceFromReader Uses

func NewJSONSourceFromReader(r io.Reader) (InputSourceContext, error)

NewJSONSourceFromReader returns an InputSourceContext suitable for retrieving config variables from an io.Reader that returns JSON data.

func NewTomlSourceFromFile Uses

func NewTomlSourceFromFile(file string) (InputSourceContext, error)

NewTomlSourceFromFile creates a new TOML InputSourceContext from a filepath.

func NewYamlSourceFromFile Uses

func NewYamlSourceFromFile(file string) (InputSourceContext, error)

NewYamlSourceFromFile creates a new Yaml InputSourceContext from a filepath.

type Int64Flag Uses

type Int64Flag struct {
    cli.Int64Flag
    // contains filtered or unexported fields
}

Int64Flag is the flag type that wraps cli.Int64Flag to allow for other values to be specified

func NewInt64Flag Uses

func NewInt64Flag(fl cli.Int64Flag) *Int64Flag

NewInt64Flag creates a new Int64Flag

func (*Int64Flag) Apply Uses

func (f *Int64Flag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped Int64Flag.Apply

func (*Int64Flag) ApplyWithError Uses

func (f *Int64Flag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped Int64Flag.ApplyWithError

type Int64SliceFlag Uses

type Int64SliceFlag struct {
    cli.Int64SliceFlag
    // contains filtered or unexported fields
}

Int64SliceFlag is the flag type that wraps cli.Int64SliceFlag to allow for other values to be specified

func NewInt64SliceFlag Uses

func NewInt64SliceFlag(fl cli.Int64SliceFlag) *Int64SliceFlag

NewInt64SliceFlag creates a new Int64SliceFlag

func (*Int64SliceFlag) Apply Uses

func (f *Int64SliceFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped Int64SliceFlag.Apply

func (*Int64SliceFlag) ApplyWithError Uses

func (f *Int64SliceFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped Int64SliceFlag.ApplyWithError

type IntFlag Uses

type IntFlag struct {
    cli.IntFlag
    // contains filtered or unexported fields
}

IntFlag is the flag type that wraps cli.IntFlag to allow for other values to be specified

func NewIntFlag Uses

func NewIntFlag(fl cli.IntFlag) *IntFlag

NewIntFlag creates a new IntFlag

func (*IntFlag) Apply Uses

func (f *IntFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped IntFlag.Apply

func (*IntFlag) ApplyInputSourceValue Uses

func (f *IntFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a int value to the flagSet if required

func (*IntFlag) ApplyWithError Uses

func (f *IntFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped IntFlag.ApplyWithError

type IntSliceFlag Uses

type IntSliceFlag struct {
    cli.IntSliceFlag
    // contains filtered or unexported fields
}

IntSliceFlag is the flag type that wraps cli.IntSliceFlag to allow for other values to be specified

func NewIntSliceFlag Uses

func NewIntSliceFlag(fl cli.IntSliceFlag) *IntSliceFlag

NewIntSliceFlag creates a new IntSliceFlag

func (*IntSliceFlag) Apply Uses

func (f *IntSliceFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped IntSliceFlag.Apply

func (*IntSliceFlag) ApplyInputSourceValue Uses

func (f *IntSliceFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a IntSlice value if required

func (*IntSliceFlag) ApplyWithError Uses

func (f *IntSliceFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped IntSliceFlag.ApplyWithError

type MapInputSource Uses

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

MapInputSource implements InputSourceContext to return data from the map that is loaded.

func (*MapInputSource) Bool Uses

func (fsm *MapInputSource) Bool(name string) (bool, error)

Bool returns an bool from the map otherwise returns false

func (*MapInputSource) BoolT Uses

func (fsm *MapInputSource) BoolT(name string) (bool, error)

BoolT returns an bool from the map otherwise returns true

func (*MapInputSource) Duration Uses

func (fsm *MapInputSource) Duration(name string) (time.Duration, error)

Duration returns a duration from the map if it exists otherwise returns 0

func (*MapInputSource) Float64 Uses

func (fsm *MapInputSource) Float64(name string) (float64, error)

Float64 returns an float64 from the map if it exists otherwise returns 0

func (*MapInputSource) Generic Uses

func (fsm *MapInputSource) Generic(name string) (cli.Generic, error)

Generic returns an cli.Generic from the map if it exists otherwise returns nil

func (*MapInputSource) Int Uses

func (fsm *MapInputSource) Int(name string) (int, error)

Int returns an int from the map if it exists otherwise returns 0

func (*MapInputSource) IntSlice Uses

func (fsm *MapInputSource) IntSlice(name string) ([]int, error)

IntSlice returns an []int from the map if it exists otherwise returns nil

func (*MapInputSource) String Uses

func (fsm *MapInputSource) String(name string) (string, error)

String returns a string from the map if it exists otherwise returns an empty string

func (*MapInputSource) StringSlice Uses

func (fsm *MapInputSource) StringSlice(name string) ([]string, error)

StringSlice returns an []string from the map if it exists otherwise returns nil

type StringFlag Uses

type StringFlag struct {
    cli.StringFlag
    // contains filtered or unexported fields
}

StringFlag is the flag type that wraps cli.StringFlag to allow for other values to be specified

func NewStringFlag Uses

func NewStringFlag(fl cli.StringFlag) *StringFlag

NewStringFlag creates a new StringFlag

func (*StringFlag) Apply Uses

func (f *StringFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped StringFlag.Apply

func (*StringFlag) ApplyInputSourceValue Uses

func (f *StringFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a String value to the flagSet if required

func (*StringFlag) ApplyWithError Uses

func (f *StringFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped StringFlag.ApplyWithError

type StringSliceFlag Uses

type StringSliceFlag struct {
    cli.StringSliceFlag
    // contains filtered or unexported fields
}

StringSliceFlag is the flag type that wraps cli.StringSliceFlag to allow for other values to be specified

func NewStringSliceFlag Uses

func NewStringSliceFlag(fl cli.StringSliceFlag) *StringSliceFlag

NewStringSliceFlag creates a new StringSliceFlag

func (*StringSliceFlag) Apply Uses

func (f *StringSliceFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped StringSliceFlag.Apply

func (*StringSliceFlag) ApplyInputSourceValue Uses

func (f *StringSliceFlag) ApplyInputSourceValue(context *cli.Context, isc InputSourceContext) error

ApplyInputSourceValue applies a StringSlice value to the flagSet if required

func (*StringSliceFlag) ApplyWithError Uses

func (f *StringSliceFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped StringSliceFlag.ApplyWithError

type Uint64Flag Uses

type Uint64Flag struct {
    cli.Uint64Flag
    // contains filtered or unexported fields
}

Uint64Flag is the flag type that wraps cli.Uint64Flag to allow for other values to be specified

func NewUint64Flag Uses

func NewUint64Flag(fl cli.Uint64Flag) *Uint64Flag

NewUint64Flag creates a new Uint64Flag

func (*Uint64Flag) Apply Uses

func (f *Uint64Flag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped Uint64Flag.Apply

func (*Uint64Flag) ApplyWithError Uses

func (f *Uint64Flag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped Uint64Flag.ApplyWithError

type UintFlag Uses

type UintFlag struct {
    cli.UintFlag
    // contains filtered or unexported fields
}

UintFlag is the flag type that wraps cli.UintFlag to allow for other values to be specified

func NewUintFlag Uses

func NewUintFlag(fl cli.UintFlag) *UintFlag

NewUintFlag creates a new UintFlag

func (*UintFlag) Apply Uses

func (f *UintFlag) Apply(set *flag.FlagSet)

Apply saves the flagSet for later usage calls, then calls the wrapped UintFlag.Apply

func (*UintFlag) ApplyWithError Uses

func (f *UintFlag) ApplyWithError(set *flag.FlagSet) error

ApplyWithError saves the flagSet for later usage calls, then calls the wrapped UintFlag.ApplyWithError

Package altsrc imports 17 packages (graph) and is imported by 2 packages. Updated 2019-08-11. Refresh now. Tools for package owners.