config

package
v0.0.0-...-7db4835 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Filename = "~/.gh-shorthand.yml"

Filename is the default file location for gh-shorthand config

Functions

This section is empty.

Types

type Config

type Config struct {
	// shorthand configs
	RepoMap     map[string]string `yaml:"repos"`
	UserMap     map[string]string `yaml:"users"`
	DefaultRepo string            `yaml:"default_repo"`

	// RPC configs
	APIToken   string `yaml:"api_token"`
	SocketPath string `yaml:"socket_path"`

	// project configs
	ProjectDirs  []string `yaml:"project_dirs"`
	Editor       string   `yaml:"editor"`
	EditorScript string   `yaml:"editor_script"`
}

Config is a shorthand configuration, read from a yaml file

func Load

func Load(yml string) (Config, error)

Load a Config from a yaml string. Returns an empty config if an error occurs.

func LoadFromDefault

func LoadFromDefault() (Config, error)

LoadFromDefault loads and validates a config.

This is a convenience for the server subcommands. Exits with an error if config can't be loaded.

func LoadFromFile

func LoadFromFile(path string) (Config, error)

LoadFromFile attempts to load a Config from a given yaml file. This always returns an empty config.

func MustLoadFromDefault

func MustLoadFromDefault() Config

MustLoadFromDefault loads from the default config location, and exits if there's an error.

func (Config) OpenEditorScript

func (c Config) OpenEditorScript() (string, error)

func (Config) RPCEnabled

func (c Config) RPCEnabled() bool

Jump to

Keyboard shortcuts

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