~mendelmaleh/pfin

509b130784d7f92355055cee39be22e0aeb60994 — Mendel E 6 days ago d99bba1 master
Add ability to set account path

Useful for nesting folders etc.
2 files changed, 9 insertions(+), 1 deletions(-)

M types.go
M util/dir.go
M types.go => types.go +8 -0
@@ 25,6 25,9 @@ type Account struct {
	// parser type, inherited from account name if unset
	Type string

	// folder path from root, inherited from account name if unset
	Path string

	// default user, inherited from config.Pfin.User if unset
	DefaultUser string `toml:"user"`



@@ 77,6 80,11 @@ func ParseConfig(path string) (config Config, err error) {
			v.Type = k
		}

		// set path to name if unset
		if v.Path == "" {
			v.Path = k
		}

		// set default user if unset
		if v.DefaultUser == "" {
			v.DefaultUser = config.Pfin.User

M util/dir.go => util/dir.go +1 -1
@@ 25,7 25,7 @@ func MatchDir(acc pfin.Account, root string) ([]string, error) {
		return matches, err
	}

	path := filepath.Join(root, acc.Name)
	path := filepath.Join(root, acc.Path)

	if path[len(path)-1] != filepath.Separator {
		path += string(filepath.Separator)