config

package
v0.0.0-...-1fcc497 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DumpConfigCommand = cli.Command{
		Action: dumpConfig,
		Name:   "dumpconfig",
		Flags: []cli.Flag{
			ConfigFileFlag,
		},
		Usage:       "Show configuration values",
		Category:    "MISCELLANEOUS COMMANDS",
		Description: `The dumpconfig command shows configuration values.`,
	}

	ConfigFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "TOML configuration file",
	}
)
View Source
var DefaultConfig = Config{}
View Source
var NewCommand = cli.Command{
	Name:  "new",
	Usage: "new config file",
	Flags: []cli.Flag{},
	Action: func(ctx *cli.Context) error {
		entity := ctx.Args().First()

		cfg := NewConfig()
		cfg.Name = entity

		configfile := defaultConfiglocation()
		cfg.Save(configfile)

		return nil
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Name          string            `toml:"name"`
	GainsDatabase string            `toml:"gains_database"`
	PriceDatabase string            `toml:"price_database"`
	StartFY       time.Time         `toml:"start_f_y"`
	EndFY         time.Time         `toml:"end_f_y"`
	Files         map[string]string `toml:"files"`
}

func LoadConfig

func LoadConfig(file string) (*Config, error)

func NewConfig

func NewConfig() *Config

func Parse

func Parse(data []byte) (*Config, error)

func (*Config) Encode

func (c *Config) Encode() ([]byte, error)

func (*Config) Save

func (cfg *Config) Save(file string) error

Jump to

Keyboard shortcuts

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