configen

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAssertionFailed = errors.New("assertion failed")

ErrAssertionFailed returned by 'assert' template function when provided arg evaluated as flase value.

View Source
var ErrInvalidArgument = errors.New("one of arguments should be string")

ErrInvalidArgument returned when at least on argument from two is not a string.

View Source
var ErrMissingValue = errors.New("missing value")

ErrMissingValue returned by 'required' template function when required value is missing.

View Source
var ErrUnknownFormat = errors.New("unknown format")

ErrUnknownFormat returned when file format unsupported or unrecognizable from file extension.

View Source
var ErrValidationError = errors.New("validation error")

ErrValidationError returned if JSON schema validation failed.

Functions

func Generate

func Generate(opts *Options, envs ...string) error

Generate is the main entry point, called after parsing command line.

func Watch added in v0.2.0

func Watch(port int, opts *Options, envs ...string) error

Watch start watching for changes of input files/directories and call Generate when change happened.

Types

type Context

type Context map[string]interface{}

Context defines generic JSON/YAML/TOML values type.

type Options

type Options struct {
	Templates []string          `short:"t" long:"template" value-name:"directory" description:"Input directory [arg: directory] (default: templates)"` //nolint:lll
	Raws      []string          `short:"r" long:"raw" value-name:"directory" description:"Raw input directory to copy (default: static)"`              //nolint:lll
	Output    string            `short:"o" long:"output" value-name:"directory" description:"Output directory (default: dist)"`                        //nolint:lll
	Schemas   []string          `short:"s" long:"schema" value-name:"directory" description:"Schema directory (default: schemas)"`                     //nolint:lll
	Values    []string          `short:"f" long:"values" value-name:"file" description:"Data values file [arg: +file] (default: values.yaml)"`         //nolint:lll
	Define    map[string]string `long:"set" value-name:"name:value" description:"Set value [arg: name=value]"`                                         //nolint:lll
	Loose     bool              `long:"loose" description:"Disable schema validation"`
	Dry       bool              `long:"dry-run" description:"Skip writing output files"`
	Dump      bool              `long:"dump" description:"Dump intermediate files"`
	Quiet     bool              `short:"q" long:"quiet" description:"Suppress console output"`
	Package   string            `short:"p" long:"package" value-name:"file" description:"Package descriptor template (default: package.json)"` //nolint:lll
}

Options holds command line flags.

Jump to

Keyboard shortcuts

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