config

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfigFile = "acc.yaml"

DefaultConfigFile states the default name of the config/project file.

Variables

DefaultProjectFiles contains the default names of all the project files of flat mode. This is used to check if a Acc project is present in a given folder.

Functions

func NewSchema

func NewSchema(folderPath, logo string, doSave, interactive, distMode bool) schema.Schema

NewSchema creates a new acc project in the given folder path.

func OpenSchema

func OpenSchema(path string) schema.Schema

OpenSchema reads first the Acc file and then tries to open all linked files.

Types

type Acc

type Acc struct {
	// Company contains the information about the organisation which uses acc.
	Company             schema.Company       `yaml:"company" default:""`
	JournalConfig       schema.JournalConfig `yaml:"journalConfig" default:""`
	Currency            string               `yaml:"currency" default:"CHF"`
	DistributedMode     bool                 `yaml:"distributedMode" default:"false"`
	ExpensesFilePath    string               `yaml:"expensesFilePath" default:"expenses.yaml"`
	InvoicesFilePath    string               `yaml:"invoicesFilePath" default:"invoices.yaml"`
	MiscRecordsFilePath string               `yaml:"miscRecordsFilePath" default:"misc.yaml"`
	PartiesFilePath     string               `yaml:"partiesFilePath" default:"parties.yaml"`
	ProjectsFilePath    string               `yaml:"projectsFilePath" default:"projects.yaml"`
	StatementFilePath   string               `yaml:"statementFilePath" default:"bank.yaml"`
	FileName            string               `yaml:"-"`
}

Acc represents an entry point into the utils and also provides general information.

func OpenAcc

func OpenAcc(path string) Acc

OpenAcc opens a Acc saved in the json file given by the path.

func (*Acc) AppendExpensesSuffix

func (a *Acc) AppendExpensesSuffix(suffix string, overwrite bool)

func (*Acc) AppendInvoiceSuffix

func (a *Acc) AppendInvoiceSuffix(suffix string, overwrite bool)

func (Acc) Conditions

func (a Acc) Conditions() util.Conditions

Conditions returns the validation conditions.

func (Acc) NewDistributedModeAcc

func (a Acc) NewDistributedModeAcc(repoPath string) Acc

NewDistributedModeAcc acc takes a flat file acc configuration file and returns the new structure for a config file in project (aka. folder) mode.

func (Acc) Save

func (a Acc) Save(path string)

Save writes the element as a json to the given path. Indented states whether «prettify» the json output.

func (Acc) SaveSchema

func (a Acc) SaveSchema(s schema.Schema)

func (Acc) SaveSchemaToFolder

func (a Acc) SaveSchemaToFolder(s schema.Schema)

SaveProjectToFolder saves all files linked in the Acc config to the base folder defined in the schema.

func (Acc) String

func (a Acc) String() string

String returns a human readable representation of the element.

func (Acc) Type

func (a Acc) Type() string

Type returns a string with the type name of the element.

func (Acc) Validate

func (a Acc) Validate() util.ValidateResults

Validate the element and return the result.

Jump to

Keyboard shortcuts

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