xform

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2019 License: MIT Imports: 10 Imported by: 0

README

Multi format transform

Transform (xform) filter for json, hcl and yaml via STDIN / STDOUT.

multi call binary xform [translation] or ln xform translation where translation is one of

  • yaml2json
  • yaml2hcl
  • json2hcl
  • json2yaml
  • hcl2json
  • hcl2yaml

For example:

ln xlate yaml2json
./yaml2json < yamlfile > jsonfile

or

./xlate yaml2json < yamlfile > jsonfile

Install

GO111MODULE=on go get -tags netgo -ldflags '-w -s' github.com/davidwalter0/xform

Use

Here's an example fixtures/infra.tf.json being converted to HCL:

$ xform json2hcl < fixtures/infra.tf.json
"output" "arn" {
  "value" = "${aws_dynamodb_table.basic-dynamodb-table.arn}"
}
... rest of HCL truncated

Typical use would be

$ xform json2hcl < fixtures/infra.tf.json > fixtures/infra.tf

hcl2json

As a bonus, the conversation the other way around is also supported via the -reverse flag:

$ xform hcl2json < fixtures/infra.tf
{
  "output": [
    {
      "arn": [
        {
          "value": "${aws_dynamodb_table.basic-dynamodb-table.arn}"
        }
      ]
    }, 
  ... rest of JSON truncated
  ]
}

Development

go get -tags netgo -ldflags '-w -s' github.com/davidwalter0/xform

upstream rational

Upstream README

If you don't know HCL, read Why HCL.

Contributors

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL