vm

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: Apache-2.0 Imports: 12 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) 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 {
	Vars             map[string]string // variables keyed by name
	CodeVars         map[string]string // code variables keyed by name
	TopLevelVars     map[string]string // TLA vars keyed by name
	TopLevelCodeVars map[string]string // TLA code vars keyed by name
	Importer         jsonnet.Importer  // optional custom importer - default is the filesystem importer
	LibPaths         []string          // library paths in filesystem, ignored when a custom importer is specified
}

Config is the desired configuration of the Jsonnet VM.

func (Config) WithCodeVars

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

WithCodeVars creates a new config that is the clone of this one with the additional code variables in its environment.

func (Config) WithLibPaths

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

WithLibPaths create a new config that is the clone of this one with additional library paths.

func (Config) WithVars

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

WithVars creates a new config that is the clone of this one with the additional variables in its environment.

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.

Source Files

  • nativefuncs.go
  • vm.go

Jump to

Keyboard shortcuts

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