kong-hcl – github.com/alecthomas/kong-hcl Index | Files

package konghcl

import "github.com/alecthomas/kong-hcl"

nolint: govet

Index

Variables

var Parser = participle.MustBuild(&Config{})

Parser for HCL.

Functions

func Loader

func Loader(r io.Reader) (kong.ResolverFunc, error)

Loader is a Kong configuration loader for HCL.

Types

type Block

type Block struct {
	Parameters []*Value `{ @@ }`
	Entries    []*Entry `"{" { @@ } "}"`
}

A Block is a group of HCL entries.

func (*Block) Find

func (b *Block) Find(path []string) *Value

type Bool

type Bool bool

A Bool value.

func (*Bool) Capture

func (b *Bool) Capture(v []string) error

type Config

type Config struct {
	Entries []*Entry `{ @@ }`
}

Config is the root configuration structure.

func (*Config) Find

func (c *Config) Find(path []string) *Value

type Entry

type Entry struct {
	Key   string `@( Ident { "-" Ident } )`
	Value *Value `( "=" @@`
	Block *Block `| @@ )`
}

An Entry in a HCL block.

func (*Entry) Find

func (e *Entry) Find(path []string) *Value

type Value

type Value struct {
	Boolean    *Bool    `  @("true"|"false")`
	Identifier *string  `| @( Ident { "-" Ident } { "." Ident { "-" Ident } } )`
	Str        *string  `| @(String|Char|RawString)`
	Number     *float64 `| @(Float|Int)`
	Array      []*Value `| "[" { @@ [ "," ] } "]"`
}

A Value for a key in HCL.

func (*Value) GoString

func (v *Value) GoString() string

func (*Value) String

func (v *Value) String() string

Source Files

loader.go parser.go

Version
v0.1.0
Published
Sep 12, 2018
Platform
js/wasm
Imports
5 packages
Last checked
now

Tools for package owners.