transfer 全平台Windows linux mac配置文件转换工具

transfer

  • 支持全平台 Windows linux mac
  • 自动检测转换文件格式
  • 支持多种格式相互转换 HCL ⇄ JSON ⇄ YAML⇄TOML⇄XML⇄plist⇄pickle⇄properties ...

install

$ go get github.com/rinetd/transfer
复制代码

Download

https://github.com/rinetd/transfer/releases
复制代码

usage

usage:

	transfer [-f] [-s input.yaml] [-t output.json] /path/to/input.yaml [/path/to/output.json]

Converts from one encoding to another. Supported formats (and their file extensions):

	- JSON (.json)
	- TOML (.toml)
	- YAML (.yaml or .yml)
	- HCL (.hcl or .tf)
	- XML (.xml)
	- MSGPACK (.msgpack)
	- PLIST (.plist)
	- BSON (.bson)
	- PICKLE (.pickle)
	- PROPERTIES (.prop or .props or .properties)

复制代码

docker usage

# build the transfer image
docker build -t rientd/transfer .
复制代码

examples

yaml格式转换为json

将 ./data/main.yml 转换到 ./data/main.json 以下几种命名格式是等价的

$ transfer -f data/main.yaml        (default output `json` format)
$ transfer -f data/main.yaml data/main.json
$ transfer -f -t json data/main.yaml
$ transfer -f -s data/main.yaml     (default output `json` format)
$ transfer -f -s data/main.yaml -t json 
$ transfer -f -s data/main.yaml -t data/main.json 
复制代码
Author:
  email: rinetd@163.com
  github: rinetd
menu:
  main:
  - Identifier: categories
    Name: categories
    Pre: <i class='fa fa-category'></i>
    URL: /categories/
    Weight: -102
  - Identifier: tags
    Name: tags
    Pre: <i class='fa fa-tags'></i>
    URL: /tags/
    Weight: -101
theme: hueman

复制代码
{
	"Author": {
		"email": "rinetd@163.com",
		"github": "rinetd"
	},
	"menu": {
		"main": [
			{
				"Identifier": "categories",
				"Name": "categories",
				"Pre": "<i class='fa fa-category'></i>",
				"URL": "/categories/",
				"Weight": -102
			},
			{
				"Identifier": "tags",
				"Name": "tags",
				"Pre": "<i class='fa fa-tags'></i>",
				"URL": "/tags/",
				"Weight": -101
			}
		]
	},
	"theme": "hueman"
}
复制代码
其他格式转换:

json -> hcl

$ transfer main.json main.hcl
复制代码

yaml -> toml

$ transfer main.yaml main.toml
复制代码
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值