env

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path string              `json:"path"`
	Env  map[string]Variable `json:"env"`
}

Config represents data of environment variables and cache file path

func New

func New(path string) *Config

New creates Config instance

func (*Config) Add

func (c *Config) Add(args ...interface{}) error

Add adds environment variable with given key and given value

func (*Config) Ask

func (c *Config) Ask(keys ...string)

Ask asks the user for input using the given query

func (*Config) AskWhen

func (c *Config) AskWhen(env map[string]bool)

func (*Config) Refresh

func (c *Config) Refresh() error

Refresh deletes existing file cache

type Input

type Input struct {
	When    bool   `json:"when,omitempty"`
	Message string `json:"message,omitempty"`
	Help    string `json:"help,omitempty"`
}

Input represents value input from terminal

type Variable

type Variable struct {
	Value   string `json:"value,omitempty"`
	Default string `json:"default,omitempty"`
	Input   Input  `json:"input,omitempty"`
}

Variable represents environment variable

type Variables

type Variables map[string]Variable

Variables is a collection of Variable and its name

Jump to

Keyboard shortcuts

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