config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config is repsonsible for setting and returning the current state of the shell in regards to configuration flags and mode options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAlias

func AddAlias(name, command string) error

AddAlias adds registers a new alias in the config

func AliasIsCyclic

func AliasIsCyclic(alias Alias) bool

AliasIsCyclic is a check to ensure that the aliases do not form an infinite loop

func GetAPIDriver

func GetAPIDriver() string

func GetDebug

func GetDebug() bool

func GetExperimental

func GetExperimental() bool

func RemoveAlias

func RemoveAlias(name string) error

RemoveAlias an alias in the config

func SetDebug

func SetDebug(enabled bool)

SetDebug assigns .Debug on the current config struct

func SetExperimental

func SetExperimental(enabled bool)

func SetPrintMode

func SetPrintMode(printMode PrintMode)

SetPrintMode assigns .CurrentPrintMode on the current config struct

Types

type Alias

type Alias struct {
	Name    string
	Command string `json:"command"`
}

Alias is the struct used to allow abstracted commands

type Config

type Config struct {
	DebugEnabled     bool             `json:"debugEnabled"`
	APIDriver        string           `json:"apiDriver"`
	Experimental     bool             `json:"experimental"`
	CurrentPrintMode PrintMode        `json:"printMode"`
	Aliases          map[string]Alias `json:"aliases"`
}

Config is the struct containing the application state

func GetConfig

func GetConfig() Config

GetConfig returns a copy of the current state struct

type PrintMode

type PrintMode string

PrintMode is a type to ensure SetPrintMode recieves a valid enum

const (
	PrintJSON   PrintMode = "json"
	PrintLine   PrintMode = "line"
	PrintPretty PrintMode = "pretty"
)

PrintMode constants enum

Jump to

Keyboard shortcuts

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