conf

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() *types.Config

Default .

func DefaultCWD added in v1.6.2

func DefaultCWD() string

DefaultCWD returns the working directory of current project, default cwd is from git rev-parse --show-toplevel command, but if the command could not execute successfully, `pwd` command will be used instead.

func DefaultConfPath

func DefaultConfPath() string

func Load

func Load(confPath string, parser ConfigParser) (cfg *types.Config, err error)

Load to load config from confPath with specified parser.

func Save

func Save(confPath string, cfg *types.Config, parser ConfigParser) error

Save to save config with specified parser.

Types

type ConfigParser

type ConfigParser interface {
	// Unmarshal ...
	Unmarshal(r io.Reader, rcv *types.Config) error

	// Marshal ...
	Marshal(cfg *types.Config) ([]byte, error)
}

ConfigParser is an interface to parse config in different ways. For example: JSON, TOML and YAML;

func NewTOMLParser

func NewTOMLParser() ConfigParser

Jump to

Keyboard shortcuts

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