vm

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package vm allows flexible creation of a Jsonnet VM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFromCommandParams

func ConfigFromCommandParams(cmd *cobra.Command, prefix string, addShortcuts bool) func() (Config, error)

ConfigFromCommandParams attaches VM related flags to the specified command and returns a function that provides the config based on command line flags.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the desired configuration of the Jsonnet VM.

func (Config) CodeVars

func (c Config) CodeVars() map[string]string

CodeVars returns the code external variables defined for this config.

func (Config) HasTopLevelVar added in v0.6.2

func (c Config) HasTopLevelVar(name string) bool

HasTopLevelVar returns true if the specified TLA variable is defined.

func (Config) HasVar added in v0.6.2

func (c Config) HasVar(name string) bool

HasVar returns true if the specified external variable is defined.

func (Config) LibPaths

func (c Config) LibPaths() []string

LibPaths returns the library paths for this config.

func (Config) TopLevelCodeVars

func (c Config) TopLevelCodeVars() map[string]string

TopLevelCodeVars returns the code top-level variables defined for this config.

func (Config) TopLevelVars

func (c Config) TopLevelVars() map[string]string

TopLevelVars returns the string top-level variables defined for this config.

func (Config) Vars

func (c Config) Vars() map[string]string

Vars returns the string external variables defined for this config.

func (Config) WithCodeVars

func (c Config) WithCodeVars(add map[string]string) Config

WithCodeVars returns a config with additional code variables in its environment.

func (Config) WithImporter added in v0.6.2

func (c Config) WithImporter(importer jsonnet.Importer) Config

WithImporter returns a config with the supplied importer.

func (Config) WithLibPaths

func (c Config) WithLibPaths(paths []string) Config

WithLibPaths returns a config with additional library paths.

func (Config) WithTopLevelCodeVars added in v0.6.2

func (c Config) WithTopLevelCodeVars(add map[string]string) Config

WithTopLevelCodeVars returns a config with additional top-level code variables in its environment.

func (Config) WithTopLevelVars added in v0.6.2

func (c Config) WithTopLevelVars(add map[string]string) Config

WithTopLevelVars returns a config with additional top-level string variables in its environment.

func (Config) WithVars

func (c Config) WithVars(add map[string]string) Config

WithVars returns a config with additional string variables in its environment.

func (Config) WithoutTopLevel added in v0.6.2

func (c Config) WithoutTopLevel() Config

WithoutTopLevel returns a config that does not have any top level variables set.

type VM

type VM struct {
	*jsonnet.VM
	// contains filtered or unexported fields
}

VM wraps a jsonnet VM and provides some additional methods to create new VMs using the same base configuration and additional tweaks.

func New

func New(config Config) *VM

New constructs a new VM based on the supplied config.

func (*VM) Config

func (v *VM) Config() Config

Config returns the current VM config.

Jump to

Keyboard shortcuts

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