usrconfig

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

README

usrconfig

GoDoc Build Status

usrconfig is a very simple platform independent user config anagement.

Usage


import "github.com/quebar/usrconfig"

type MyConfig struct {
    Name  string `yaml:"user_name"`
    Email string `yaml:"user_email"`
}

conf := MyConfig{
    Name: "QeuBar",
    Email: "que@bar.com",
}

usrconfig.Update(conf, "my-app")
Supported platforms

usrconfig is built to work on any platform that supports Go.

Documentation

Overview

Package usrconfig provides a minimal interface to store and update user specific application config on the supported platform. It takes away guess work and indecisiveness by using the default application config directory based on the running platform.

It's as simple as:

 type MyConfig struct {
		Name  string `yaml:"user_name"`
		Email string `yaml:"user_email"`
 }

 var conf MyConfig
 usrconfig.Load(&conf, "my-app")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(config interface{}, app string) error

Load will load an existing "config" for "app". It supports structs of `json`, `yaml` and `xml` format.

func Update

func Update(config interface{}, app string) error

Update encodes the provided "config" and saves it to the "app" config file. It supports structs of `json`, `yaml` and `xml` format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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