Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v3.10.13 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config contains helper methods for client side config management (`~/.micro/config.json` file). It uses the `JSONValues` helper

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commands defines a set of commands for local config
	Commands = []*cli.Command{
		{
			Name:   "get",
			Usage:  "Get a value by specifying [key] as an arg",
			Action: get,
		},
		{
			Name:   "set",
			Usage:  "Set a key-val using [key] [value] as args",
			Action: set,
		},
		{
			Name:   "delete",
			Usage:  "Delete a value using [key] as an arg",
			Action: del,
		},
	}
)
View Source
var (

	// File is the filepath to the config file that
	// contains all user configuration
	File = filepath.Join(user.Dir, "config.json")
)

Functions

func Get

func Get(path string) (string, error)

Get a value from the .micro file

func Path

func Path(paths ...string) string

func Set

func Set(path, value string) error

Set a value in the .micro file

func SetConfig

func SetConfig(configFilePath string)

SetConfig sets the config file

func WriteVersion

func WriteVersion(v string) error

WriteVersion will write a version update to a file ./micro/version. This indicates the current version and the last time we updated the binary. Its only used where self update is

Types

type Version

type Version struct {
	Version string    `json:"version"`
	Updated time.Time `json:"updated"`
}

Version represents ./micro/version

func GetVersion

func GetVersion() (*Version, error)

GetVersion returns the version from .micro/version. If it does not exist

Jump to

Keyboard shortcuts

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