config

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 2 Imported by: 4

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 AliasIsCyclic

func AliasIsCyclic(newAlias Alias, allAliases map[string]Alias) bool

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

Types

type Alias

type Alias struct {
	Name        string
	Description string `json:"description"`
	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"`
	PrintMode    PrintModeEnum    `json:"printMode"`
	Aliases      map[string]Alias `json:"aliases"`
}

Config is the struct containing the application state

func (*Config) AddAlias

func (config *Config) AddAlias(name, command string) error

AddAlias adds registers a new alias in the config

func (*Config) RemoveAlias

func (config *Config) RemoveAlias(name string) error

RemoveAlias an alias in the config

func (*Config) SetPrintMode

func (config *Config) SetPrintMode(printMode PrintModeEnum)

SetPrintMode assigns .PrintMode on the current config struct

func (*Config) Validate

func (config *Config) Validate()

Validate is responsible for filtering incorrect aliases configured, and printing the state of debug modes

type PrintModeEnum

type PrintModeEnum string

PrintModeEnum is a type to ensure SetPrintMode recieves a valid enum

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

PrintModeEnum constants enum

Jump to

Keyboard shortcuts

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