https://github.com/alecthomas/kong-yaml
https://github.com/alecthomas/kong-yaml
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/alecthomas/kong-yaml
- Owner: alecthomas
- License: mit
- Created: 2018-09-11T04:20:37.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-14T23:50:04.000Z (over 2 years ago)
- Last Synced: 2024-05-02T00:28:07.812Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 13
- Watchers: 4
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: COPYING
Awesome Lists containing this project
README
# Kong YAML utilities [](http://godoc.org/github.com/alecthomas/kong-yaml) [](https://circleci.com/gh/alecthomas/kong-yaml)
## Configuration loader
Use it like so:
```go
parser, err := kong.New(&cli, kong.Configuration(kongyaml.Loader, "/etc/myapp/config.yaml", "~/.myapp.yaml"))
```
## YAMLFileMapper
YAMLFileMapper implements kong.MapperValue to decode a YAML file into
a struct field.
Use it like so:
```go
var cli struct {
Profile Profile `type:"yamlfile"`
}
func main() {
kong.Parse(&cli, kong.NamedMapper("yamlfile", kongyaml.YAMLFileMapper))
}
```