cliflags

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateMethod

type DateMethod string
const (
	DateMethodNone         DateMethod = "NONE"
	DateMethodName         DateMethod = "FILENAME"
	DateMethodEXIF         DateMethod = "EXIF"
	DateMethodNameThenExif DateMethod = "FILENAME-EXIF"
	DateMethodExifThenName DateMethod = "EXIF-FILENAME"
)

func (*DateMethod) Set

func (dm *DateMethod) Set(s string) error

func (*DateMethod) String

func (dm *DateMethod) String() string

func (*DateMethod) Type

func (dm *DateMethod) Type() string

type DateRange

type DateRange struct {
	After, Before time.Time // todo: make After and Before private
	// contains filtered or unexported fields
}

func InitDateRange

func InitDateRange(tz *time.Location, s string) DateRange

InitDateRange initialize a DateRange with a string (for tests)

func (DateRange) InRange

func (dr DateRange) InRange(d time.Time) bool

InRange checks if a given date is within the range

func (DateRange) IsSet

func (dr DateRange) IsSet() bool

IsSet returns whether the date range is set

func (DateRange) MarshalJSON added in v0.29.0

func (dr DateRange) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (DateRange) MarshalText added in v0.29.0

func (dr DateRange) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (DateRange) MarshalYAML added in v0.29.0

func (dr DateRange) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*DateRange) Set

func (dr *DateRange) Set(s string) (err error)

Implements the flags interface A day: 2022-01-01 A month: 2022-01 A year: 2022 A range: 2022-01-01,2022-12-31

func (*DateRange) SetTZ

func (dr *DateRange) SetTZ(tz *time.Location)

func (DateRange) String

func (dr DateRange) String() string

func (DateRange) Type

func (dr DateRange) Type() string

func (*DateRange) UnmarshalJSON added in v0.29.0

func (dr *DateRange) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (*DateRange) UnmarshalText added in v0.29.0

func (dr *DateRange) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*DateRange) UnmarshalYAML added in v0.29.0

func (dr *DateRange) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler

type ExtensionList

type ExtensionList []string

An ExtensionList is a list of file extensions, where each extension is a string that starts with a dot (.) and is in lowercase.

func (ExtensionList) Exclude

func (sl ExtensionList) Exclude(s string) bool

Exclude checks if the extension list excludes a given extension.

func (ExtensionList) Include

func (sl ExtensionList) Include(s string) bool

Include checks if the extension list includes a given extension.

func (*ExtensionList) Set

func (sl *ExtensionList) Set(s string) error

Implements the flag interface

func (ExtensionList) String

func (sl ExtensionList) String() string

func (ExtensionList) Type

func (sl ExtensionList) Type() string

func (ExtensionList) Validate

func (sl ExtensionList) Validate() ExtensionList

Validate validates the extension list by converting to lowercase.

type IncludeType added in v0.24.7

type IncludeType string

An IncludeType is either of the constants below which represents a collection of extensions.

const (
	IncludeAll   IncludeType = ""
	IncludeVideo IncludeType = "VIDEO"
	IncludeImage IncludeType = "IMAGE"
)

func (*IncludeType) Set added in v0.24.7

func (t *IncludeType) Set(v string) error

Implements the flag interface

func (IncludeType) String added in v0.24.7

func (t IncludeType) String() string

func (IncludeType) Type added in v0.24.7

func (t IncludeType) Type() string

type InclusionFlags

type InclusionFlags struct {
	ExcludedExtensions ExtensionList
	IncludedExtensions ExtensionList
	IncludedType       IncludeType
	DateRange          DateRange
}

func (*InclusionFlags) RegisterFlags added in v0.29.0

func (flags *InclusionFlags) RegisterFlags(fs *pflag.FlagSet, prefix string)

func (*InclusionFlags) SetIncludeTypeExtensions added in v0.29.0

func (flags *InclusionFlags) SetIncludeTypeExtensions()

SetIncludeTypeExtensions must be called once flags are parsed

func (*InclusionFlags) Validate

func (flags *InclusionFlags) Validate()

Validate validates the common flags.

type OnErrorsFlag added in v0.29.0

type OnErrorsFlag int
const (
	OnErrorsStop OnErrorsFlag = iota
	OnErrorsStopAfter
	OnErrorsNeverStop = -1
)

func (OnErrorsFlag) MarshalJSON added in v0.29.0

func (f OnErrorsFlag) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (OnErrorsFlag) MarshalTOML added in v0.29.0

func (f OnErrorsFlag) MarshalTOML() ([]byte, error)

MarshalTOML implements the toml.Marshaler interface.

func (OnErrorsFlag) MarshalText added in v0.29.0

func (f OnErrorsFlag) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (OnErrorsFlag) MarshalYAML added in v0.29.0

func (f OnErrorsFlag) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*OnErrorsFlag) RegisterFlags added in v0.29.0

func (f *OnErrorsFlag) RegisterFlags(fs *pflag.FlagSet, prefix string)

func (*OnErrorsFlag) Set added in v0.29.0

func (f *OnErrorsFlag) Set(value string) error

func (OnErrorsFlag) String added in v0.29.0

func (f OnErrorsFlag) String() string

func (OnErrorsFlag) Type added in v0.29.0

func (OnErrorsFlag) Type() string

func (*OnErrorsFlag) UnmarshalJSON added in v0.29.0

func (f *OnErrorsFlag) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*OnErrorsFlag) UnmarshalTOML added in v0.29.0

func (f *OnErrorsFlag) UnmarshalTOML(data []byte) error

UnmarshalTOML implements the toml.Unmarshaler interface.

func (*OnErrorsFlag) UnmarshalText added in v0.29.0

func (f *OnErrorsFlag) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (*OnErrorsFlag) UnmarshalYAML added in v0.29.0

func (f *OnErrorsFlag) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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