settings

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package setting implements config file settings for go-homebank-csv.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFileGlobPatternValid

func IsFileGlobPatternValid(pattern string) bool

IsFileGlobPatternValid reports whether a file glob pattern is valid.

  • pattern: the file glob pattern to be validated.
  • bool: returns true if the pattern is valid, false otherwise.

Types

type BatchConvertSet

type BatchConvertSet struct {
	// Name of the batchconvert set, must be unique
	Name string `yaml:"name"`
	// Where to search for input files, must be non-empty
	InputDir string `yaml:"inputdir"`
	// Where to place output files, must be non-empty and not equal to InputDir
	OutputDir string `yaml:"outputdir"`
	// Source format, nil to use format autodetect
	Format *parser.SourceFormat `yaml:"format"`
	// Glob pattern to search for input files
	FileGlobPattern string `yaml:"fileglobpattern"`
	// Maximum age of input files in days
	FileMaxAgeDays int `yaml:"filemaxagedays"`
}

func (BatchConvertSet) CheckValidity

func (s BatchConvertSet) CheckValidity() error

CheckValidity reports whether a BatchConvertSet is valid

Possible errors:

  • Name is empty
  • InputDir is empty
  • OutputDir is empty
  • OutputDir == InputDir
  • FileMaxAgeDays < 0
  • FileGlobPattern is invalid

func (*BatchConvertSet) LoadFromString

func (s *BatchConvertSet) LoadFromString(str string) error

type BatchConvertSets

type BatchConvertSets []BatchConvertSet

func (BatchConvertSets) CheckValidity

func (s BatchConvertSets) CheckValidity() error

CheckValidity reports whether a BatchConvertSets are valid

Possible errors:

  • invalid CheckValidity() of entry
  • duplicate Name
  • duplicate InputDir / FileGlobPattern combination

type BatchConvertSettings

type BatchConvertSettings struct {
	Sets BatchConvertSets `yaml:"sets"`
}

type Settings

type Settings struct {
	BatchConvert BatchConvertSettings `yaml:"batchconvert"`
}

func (Settings) CheckValidity

func (s Settings) CheckValidity() error

CheckValidity reports whether a the whole settings are valid

func (*Settings) LoadFromDefaultFile

func (settings *Settings) LoadFromDefaultFile() (string, error)

LoadFromDefaultFile loads settings from default config file.

func (*Settings) LoadFromFile

func (settings *Settings) LoadFromFile(filePath string) error

func (*Settings) LoadFromString

func (settings *Settings) LoadFromString(str string) error

Jump to

Keyboard shortcuts

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