项目作者: rinetd

项目描述 :
Converts from one encoding to another. Supported formats HCL ⇄ JSON ⇄ YAML⇄TOML⇄XML⇄plist⇄pickle⇄properties ...
高级语言: Go
项目地址: git://github.com/rinetd/transfer.git
创建时间: 2018-08-25T01:10:42Z
项目社区:https://github.com/rinetd/transfer

开源协议:Apache License 2.0

下载


transfer GoDocBuild Status

中文文档

Converts from one encoding to another.

Supported formats HCL ⇄ JSON ⇄ YAML⇄TOML⇄XML⇄plist⇄pickle⇄properties …

install

  1. $ go get github.com/rinetd/transfer

Download

  1. https://github.com/rinetd/transfer/releases

usage

  1. usage:
  2. transfer [-f] [-s input.yaml] [-o output.json] /path/to/input.yaml [/path/to/output.json]
  3. Converts from one encoding to another. Supported formats (and their file extensions):
  4. - JSON (.json)
  5. - TOML (.toml)
  6. - YAML (.yaml or .yml)
  7. - HCL (.hcl or .tf)
  8. - XML (.xml)
  9. - MSGPACK (.msgpack)
  10. - PLIST (.plist)
  11. - BSON (.bson)
  12. - PICKLE (.pickle)
  13. - PROPERTIES (.prop or .props or .properties)

docker usage

  1. # build the transfer image
  2. docker build -o rientd/transfer .

examples

Convert data/input.yml TO data/input.json
$ transfer -f data/input.yaml (output “./data/input.json”)

  1. $ transfer -f data/input.yaml out.json (output "./out.json")
  2. $ transfer -f -s data/input.yaml -o /root/out.toml (output "/root/out.toml")
  3. $ transfer -f -s data/input.yaml -o hcl (output "./data/input.hcl")
  4. $ transfer -f -o yaml data/input.json (output "data/input.yaml")
  1. Author:
  2. email: rinetd@163.com
  3. github: rinetd
  4. menu:
  5. main:
  6. - Identifier: categories
  7. Name: categories
  8. Pre: <i class='fa fa-category'></i>
  9. URL: /categories/
  10. Weight: -102
  11. - Identifier: tags
  12. Name: tags
  13. Pre: <i class='fa fa-oags'></i>
  14. URL: /tags/
  15. Weight: -101
  16. theme: hueman
  1. {
  2. "Author": {
  3. "email": "rinetd@163.com",
  4. "github": "rinetd"
  5. },
  6. "menu": {
  7. "main": [
  8. {
  9. "Identifier": "categories",
  10. "Name": "categories",
  11. "Pre": "<i class='fa fa-category'></i>",
  12. "URL": "/categories/",
  13. "Weight": -102
  14. },
  15. {
  16. "Identifier": "tags",
  17. "Name": "tags",
  18. "Pre": "<i class='fa fa-oags'></i>",
  19. "URL": "/tags/",
  20. "Weight": -101
  21. }
  22. ]
  23. },
  24. "theme": "hueman"
  25. }
  1. $ transfer main.json main.hcl