retab ➡️
Simplify your config management with retab. This tool transforms .retab files (using hcl syntax)into YAML or JSON, allowing you to write in HCL and enjoy the readability benefits of tab indentation.
⭐️ Key Features
- Compile: Transform
.retab/*.retab files into .yaml or .json files.
- Format: Format
.retab/*.retab files for clearer and accessable indentation.
🛠️ Install from the Source
go install github.com/walteh/retab/cmd/retab
🚀 Quick Start
- Create a
.retab/*.retab file:
BRANCH = "main"
gen "hello-world-github-workflow" {
path = "./.github/workflows/hello-world.yaml"
schema = "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json"
data = {
name = "hello-world"
on = {
push = {
branches = [BRANCH]
}
}
jobs = {
say-hello = my_custom_type.my_custom_name.another_custom_type.do_whatever_you_want
}
}
}
my_custom_type "my_custom_name" {
another_custom_type {
do_whatever_you_want = {
runs-on = "ubuntu-latest"
steps = [
{
name = "Checkout"
uses = "actions/checkout@v4"
with = {
fetch-depth = 1
}
},
{
name = "Run tests"
run = <<SHELL
echo "Hello world"
SHELL
}
]
}
}
}
- Format with
retab fmt:
retab fmt
- Compile with
retab gen:
retab gen
This generates a .yaml or .json file based on your .retab/*.retab file.
# code generated by retab. DO NOT EDIT.
# join the fight against yaml @ github.com/walteh/retab
# source: ".retab/hello-world.retab"
name: hello-world
"on":
push:
branches:
- main
jobs:
say-hello:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run tests
run: |
echo "Hello world"
🤨 Why retab?
retab offers a streamlined approach to managing configurations. It combines the simplicity of HCL with the power of YAML/JSON, all while making indentation more readable and organized with tabs.
For advanced users, retab extends its formatting prowess beyond .retab files:
retab wfmt --file=./main.hcl
retab wfmt --file=./main.proto
Requires terraform fmt
retab wfmt --file=./main.tf
Requires dart format
retab wfmt --file=./main.dart
🥊 Join the fight against YAML!
retab is an open source project, and we welcome your contributions. To get started, just submit a pull request.
🛜 Keywords
- YAML and JSON Compiler
- HCL Formatting
- Config Management Tool
- Terraform Formatting
- Dart File Formatting
- Terraform Formatter
- HCL Formatter
- HCL to YAML
- HCL to JSON
- HCL to YAML Compiler
- HCL to JSON Compiler
- HashiCorp Configuration Language
- YAML Configuration
- JSON Configuration
- Tab Indentation in Terraform