config

package
v0.0.0-...-873fb03 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	File            = "configs.toml"
	DefaultLang     = "English"
	DefaultTutorial = "enabled"
	DefaultMetrics  = "yes"
	DefaultRunType  = formula.DockerRun
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configs

type Configs struct {
	Language string             `toml:"language"`
	Tutorial string             `toml:"tutorial"`
	Metrics  string             `toml:"metrics"`
	RunType  formula.RunnerType `toml:"runType"`
}

type Manager

type Manager struct {
	ConfigsPath string
}

func NewManager

func NewManager(ritHome string) Manager

func (Manager) Read

func (m Manager) Read() (Configs, error)

Read reads the Configs file inside the .rit home dir If configs.toml does not exist it's return a default value and error == nil:

Configs{
		Language: DefaultLang,
		Tutorial: DefaultTutorial,
		Metrics:  DefaultMetrics,
		RunType:  DefaultRunType,
	}

in case of an error decoding the error != nil

func (Manager) Write

func (m Manager) Write(configs Configs) error

Write creates or update the ritchie configuration. Case success the error == nil

type Reader

type Reader interface {
	Read() (Configs, error)
}

type Writer

type Writer interface {
	Write(configs Configs) error
}

Jump to

Keyboard shortcuts

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