flags

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenFile added in v0.0.14

func OpenFile(p string) (*bufio.Reader, error)

OpenFile opens the file at the given path as a buffered reader.

Types

type AccountFlag added in v0.0.14

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

AccountFlag manages a flag to parse a commodity.

func (*AccountFlag) Set added in v0.0.14

func (cf *AccountFlag) Set(v string) error

Set implements pflag.Value.

func (AccountFlag) String added in v0.0.14

func (cf AccountFlag) String() string

Value returns the flag value.

func (AccountFlag) Type added in v0.0.14

func (cf AccountFlag) Type() string

Type implements pflag.Value.

func (AccountFlag) Value added in v0.0.14

func (cf AccountFlag) Value(ctx journal.Context) (*journal.Account, error)

Value returns the account.

func (AccountFlag) ValueWithDefault added in v0.0.14

func (cf AccountFlag) ValueWithDefault(ctx journal.Context, def *journal.Account) (*journal.Account, error)

ValueWithDefault returns the account. If no account has been specified, the default is returned.

type CommodityFlag added in v0.0.14

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

CommodityFlag manages a flag to parse a commodity.

func (*CommodityFlag) Set added in v0.0.14

func (cf *CommodityFlag) Set(v string) error

Set implements pflag.Value.

func (CommodityFlag) String added in v0.0.14

func (cf CommodityFlag) String() string

Value returns the flag value.

func (CommodityFlag) Type added in v0.0.14

func (cf CommodityFlag) Type() string

Type implements pflag.Value.

func (CommodityFlag) Value added in v0.0.14

func (cf CommodityFlag) Value(ctx journal.Context) (*journal.Commodity, error)

Value returns the commodity.

type DateFlag added in v0.0.14

type DateFlag time.Time

DateFlag manages a flag to determine a date.

func (*DateFlag) Set added in v0.0.14

func (tf *DateFlag) Set(v string) error

Set implements pflag.Value.

func (DateFlag) String added in v0.0.14

func (tf DateFlag) String() string

func (DateFlag) Type added in v0.0.14

func (tf DateFlag) Type() string

Type implements pflag.Value.

func (DateFlag) Value added in v0.0.14

func (tf DateFlag) Value() time.Time

Value returns the flag value.

func (DateFlag) ValueOr added in v0.0.16

func (tf DateFlag) ValueOr(t time.Time) time.Time

type IntervalFlags added in v0.0.14

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

IntervalFlags manages multiple flags to determine a time period.

func (*IntervalFlags) Setup added in v0.0.14

func (pf *IntervalFlags) Setup(cmd *cobra.Command, def date.Interval)

Setup configures the flags.

func (IntervalFlags) Value added in v0.0.14

func (pf IntervalFlags) Value() date.Interval

Value returns the period.

type MappingFlag added in v0.0.14

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

MappingFlag manages a flag of type -c1,<regex>.

func (*MappingFlag) Set added in v0.0.14

func (cf *MappingFlag) Set(v string) error

Set implements pflag.Value.

func (MappingFlag) String added in v0.0.14

func (cf MappingFlag) String() string

func (MappingFlag) Type added in v0.0.14

func (cf MappingFlag) Type() string

Type implements pflag.Value.

func (*MappingFlag) Value added in v0.0.14

func (cf *MappingFlag) Value() journal.AccountMapping

Value returns the value of this flag.

type PeriodFlag added in v0.1.1

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

func (*PeriodFlag) Setup added in v0.1.1

func (pf *PeriodFlag) Setup(cmd *cobra.Command, def date.Period)

func (*PeriodFlag) Value added in v0.1.1

func (pf *PeriodFlag) Value() date.Period

type RegexFlag added in v0.0.14

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

RegexFlag manages a flag to get a regex.

func (*RegexFlag) Regex added in v0.1.1

func (rf *RegexFlag) Regex() regex.Regexes

func (*RegexFlag) Set added in v0.0.14

func (rf *RegexFlag) Set(v string) error

Set implements pflag.Set.

func (RegexFlag) String added in v0.0.14

func (rf RegexFlag) String() string

func (RegexFlag) Type added in v0.0.14

func (rf RegexFlag) Type() string

Type implements pflag.Type.

Jump to

Keyboard shortcuts

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