entrypoint

package
v0.0.0-...-56c4165 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: GPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatAuto = "auto"
)

Variables

This section is empty.

Functions

func Entrypoint

func Entrypoint(args LaunchArgs) int

Entrypoint implements the actual functionality of the program so it can be called inline from testing. env is normally passed the environment variable array.

Types

type CustomFilterSpec

type CustomFilterSpec struct {
	FilterFunc pongo2.FilterFunction
	NoopFunc   pongo2.FilterFunction
}

CustomFilterSpec is a map of custom filters p2 implements. These are gated behind the --enable-filter command line option as they can have unexpected or even unsafe behavior (i.e. templates gain the ability to make filesystem modifications). Disabled filters are stubbed out to allow for debugging.

type DataSource

type DataSource int

DataSource is an enumeration of the sources of input data we can take.

const (
	// SourceEnv means input comes from environment variables.
	SourceEnv DataSource = iota
	// SourceEnvKey means input comes from the value of a specific environment key.
	SourceEnvKey DataSource = iota
	// SourceStdin means input comes from stdin.
	SourceStdin DataSource = iota
	// SourceFile means input comes from a file.
	SourceFile DataSource = iota
)

type LaunchArgs

type LaunchArgs struct {
	StdIn  io.Reader
	StdOut io.Writer
	StdErr io.Writer
	Env    map[string]string
	Args   []string
}

type Options

type Options struct {
	Logging struct {
		Level  string `default:"warning" help:"logging level"`
		Format string `default:"console" enum:"console,json"  help:"logging format (${enum})"`
	} `embed:"" prefix:"logging."`

	DumpInputData bool `help:"Print Go serialization to stderr and then exit" name:"debug"`

	UseEnvKey    bool   `help:"Treat --input as an environment key name to read. This is equivalent to specifying --format=envkey"`
	Format       string `` /* 207-byte string literal not displayed */
	IncludeEnv   bool   `help:"Implicitly include environment variables in addition to any supplied data"`
	TemplateFile string `` /* 207-byte string literal not displayed */
	DataFile     string `` /* 152-byte string literal not displayed */
	OutputFile   string `` /* 152-byte string literal not displayed */

	TarFile string `default:"" help:"Output content as a tar file with the given name or to stdout (-)" name:"tar"`

	CustomFilters     string `help:"Enable custom P2 filters"                                              name:"enable-filters"`
	CustomFilterNoops bool   `help:"Enable all custom filters in no-op mode. Supercedes --enable-filters." name:"enable-noop-filters"`

	Autoescape bool `help:"Enable autoescaping"`

	DirectoryMode     bool   `help:"Treat template path as directory-tree, output path as target directory"`
	FilenameSubstrDel string `` /* 131-byte string literal not displayed */

	InputRootKey string `` /* 164-byte string literal not displayed */

	Version kong.VersionFlag `help:"Print the version and exit"`
}

type SupportedType

type SupportedType int

SupportedType is an enumeration of data types we support.

const (
	// TypeUnknown is the default error type.
	TypeUnknown SupportedType = iota
	// TypeJSON is JSON.
	TypeJSON SupportedType = iota
	// TypeYAML is YAML.
	TypeYAML SupportedType = iota
	// TypeEnv is key=value pseudo environment files.
	TypeEnv SupportedType = iota
)

Jump to

Keyboard shortcuts

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