Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lpil/cymbal
Build YAML in Gleam!
https://github.com/lpil/cymbal
Last synced: 21 days ago
JSON representation
Build YAML in Gleam!
- Host: GitHub
- URL: https://github.com/lpil/cymbal
- Owner: lpil
- Created: 2024-02-13T20:29:59.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-25T13:20:54.000Z (5 months ago)
- Last Synced: 2024-11-17T17:50:13.169Z (25 days ago)
- Language: Gleam
- Size: 4.88 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-gleam - cymbal - [📚](https://hexdocs.pm/cymbal/) - Build YAML in Gleam! (Packages / Formats)
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
```