fftoml

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: MIT Imports: 4 Imported by: 0

README

fftoml - A TOML config file parser

This is a super basic alternative toml parser to the existing: https://github.com/peterbourgon/ff/blob/master/fftoml/fftoml.go

The purpose of this version is to support TOML tables. When presented with a table this parser concatenates the nested keys with a - before settings them via the set() function.

For example:

[config]
key = "value"
[config.property]
key = "other-value"

Can be parsed into the following flags:

flag.String("config-key", "", "some config flag")
flag.String("config-property-key", "", "some other config flag")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConfigFile

func ParseConfigFile(r io.Reader, set func(name, value string) error) error

ParseConfigFile parses the provided reader as TOML and sets each found key on the provided set function

It supports TOML tables by concatenating nested table keys together with a single "-" character

For example, given the following document:

[config]
key = value
[config.property]
key = other-value

The following flags can be set: flag.String("config-key", "", "some config flag") flag.String("config-property-key", "", "some other config flag")

Types

This section is empty.

Jump to

Keyboard shortcuts

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