env

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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