Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lpil/cymbal

Build YAML in Gleam!
https://github.com/lpil/cymbal

Last synced: about 2 months ago
JSON representation

Build YAML in Gleam!

Awesome Lists containing this project

README

        

# cymbal

Build YAML in Gleam!

[![Package Version](https://img.shields.io/hexpm/v/cymbal)](https://hex.pm/packages/cymbal)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/cymbal/)

```sh
gleam add cymbal
```
```gleam
import cymbal.{block, array, string, int}

pub fn main() {
let document =
block([
#("apiVersion", string("v1")),
#("kind", string("Pod")),
#("metadata", block([#("name", string("example-pod"))])),
#(
"spec",
block([
#(
"containers",
array([
block([
#("name", string("example-container")),
#("image", string("nginx")),
#("ports", array([block([#("containerPort", int(80))])])),
]),
]),
),
]),
),
])

cymbal.encode(document)
// ---
// apiVersion: v1
// kind: Pod
// metadata:
// name: example-pod
// spec:
// containers:
// - name: example-container
// image: nginx
// ports:
// - containerPort: 80
)
}
```

Further documentation can be found at .

## Development

```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```