Description
Processing NestedText (NestedText.org: A Human Friendly Data Format) in Go.
NestedText is somewhat reminiscent of YAML, without the complexity of the latter and without the sometimes confusing details of interpretation. NestedText does not interpret any data types (unlike YAML), nor does it impose a schema.
nestext alternatives and similar packages
Based on the "Configuration" category.
Alternatively, view nestext alternatives based on common mentions on social networks and blogs.
-
koanf
Simple, extremely lightweight, extensible, configuration management library for Go. Support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper. -
konfig
Composable, observable and performant config handling for Go for the distributed processing era -
gookit/config
📝 Go configuration manage(load,get,set,export). support JSON, YAML, TOML, Properties, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名 -
gcfg
read INI-style configuration files into Go structs; supports user-defined types and subsections -
goConfig
DISCONTINUED. goconfig uses a struct as input and populates the fields of this struct with parameters from command line, environment variables and configuration file. -
joshbetz/config
🛠 A configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP. -
configuro
An opinionated configuration loading framework for Containerized and Cloud-Native applications. -
hocon
go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config -
configure
Configure is a Go package that gives you easy configuration of your project through redundancy -
Genv
Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file. -
swap
Instantiate/configure structs recursively, based on build environment. (YAML, TOML, JSON and env).
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of nestext or a related project?
Popular Comparisons
README
nestext
Processing NestedText (NestedText: A Human Friendly Data Format) in Go.
A description of NestedText by the authors:
NestedText is a file format for holding structured data that is to be entered, edited, or viewed by people. It allows data to be organized into a nested collection of dictionaries, lists, and strings without the need for quoting or escaping. In this way it is similar to JSON, YAML and TOML, but without the complexity and risk of YAML and without the syntactic clutter of JSON and TOML. NestedText is both simple and natural.
To get a feel for the NestedText format, take a look at the following example (shortended version from the NestedText site):
# Contact information for our officers
president:
name: Katheryn McDaniel
address:
> 138 Almond Street
> Topeka, Kansas 20697
phone:
cell: 1-210-555-5297
home: 1-210-555-8470
# Katheryn prefers that we always call her on her cell phone.
email: [email protected]
additional roles:
- board member
vice president:
name: Margaret Hodge
…
NestedText does not interpret any data types (unlike YAML), nor does it impose a schema. All of that has to be done by the application.
Decoding
Parse(…)
is the top-level API:
input := `
# Example for a NestedText dict
a: Hello
b: World
`
result, err := nestext.Parse(strings.NewReader(input))
if err != nil {
log.Fatal("parsing failed")
}
fmt.Printf("result = %#v\n", result)
will yield:
result = map[string]interface {}{"a":"Hello", "b":"World"}
Clients may use tools like mitchellh/mapstructure
or knadh/koanf
for further processing.
Encoding
Sub-package ntenc
provides an encoder-API:
var config = map[string]interface{}{
"timeout": 20,
"ports": []interface{}{6483, 8020, 9332},
}
n, err := ntenc.Encode(config, os.Stdout)
fmt.Println("------------------------------")
fmt.Printf("%d bytes written, error: %v", n, err != nil)
will yield:
ports:
- 6483
- 8020
- 9332
timeout: 20
------------------------------
46 bytes written, error: false
Status
Tested with NestedText test suite for Version 3.1.0.