internal

package
v0.0.0-...-3d51ea4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvFallbackFlag

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

EnvFallbackFlag is a custom flag type which retrieves the value from either an input flag or env var. If both are set then the flag takes priority. This type implements the pflag.Value interface.

func NewEnvFallbackFlag

func NewEnvFallbackFlag(flagName, envVar string) *EnvFallbackFlag

NewEnvFallbackFlag constructs an EnvFallbackFlag with the provided env var as a fallback location to read values.

func (*EnvFallbackFlag) Get

func (e *EnvFallbackFlag) Get() (string, error)

Get returns the value preferring the flag input over the env var value. If neither are set then an error is returned.

func (*EnvFallbackFlag) Set

func (e *EnvFallbackFlag) Set(input string) error

Set is used within the pflag library to configure value based on a provided flag value.

func (*EnvFallbackFlag) String

func (e *EnvFallbackFlag) String() string

String returns a default value as a string. This is only used within the pflag library. Callers should prefer to use Get().

func (*EnvFallbackFlag) Type

func (e *EnvFallbackFlag) Type() string

type StringSet

type StringSet []string

A string set which maintains an ascending sort order.

func (StringSet) Insert

func (s StringSet) Insert(newString string) StringSet

Insert adds a new string to the sorted string set if it is not already present.

type TraindownReader

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

TraindownReader reads a file or directory and returns Traindown data.

func NewTraindownReader

func NewTraindownReader(suffix string) *TraindownReader

NewTraindownReader returns a new TraindownReader. All files that do not have the provided suffix are ignored.

func (*TraindownReader) Read

func (t *TraindownReader) Read(input string) ([]*traindown.Session, error)

Read reads the traindown files referenced in the input file path. If the input is a directory then the reader will traverse it and read all files.

Jump to

Keyboard shortcuts

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