savvy

package
v0.0.0-...-a0f06a5 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfigDirectory -
	DefaultConfigDirectory = func() string {
		home, err := os.UserHomeDir()

		if err != nil {
			fmt.Print("Failed to find home directory.")
			os.Exit(1)
		}

		return path.Join(home, ".savvy")
	}
	// DefaultConfigFileName -
	DefaultConfigFileName = "config"
	// DefaultConfigFilePath -
	DefaultConfigFilePath = path.Join(DefaultConfigDirectory(), DefaultConfigFileName+".yaml")
)

Functions

func PrintError

func PrintError(msg string)

PrintError - prints error in red and exits

func PrintInfo

func PrintInfo(msg string)

PrintInfo - prints message in white

func PrintSuccess

func PrintSuccess(msg string)

PrintSuccess - prints message in green

func PrintWarning

func PrintWarning(msg string)

PrintWarning - prints message in yellow as warning

Types

type APIConfig

type APIConfig struct {
	URL string `yaml:"url"`
	Key string `yaml:"key"`
}

type Config

type Config struct {
	API APIConfig `yaml:"api"`
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) Generate

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

func (*Config) WriteToFile

func (c *Config) WriteToFile(dirPath, fileName string) error

WriteToFile - Writes the config model to a file

Jump to

Keyboard shortcuts

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