3 个不稳定版本
0.2.0 | 2020 年 10 月 15 日 |
---|---|
0.1.1 | 2020 年 10 月 15 日 |
0.1.0 | 2020 年 10 月 15 日 |
#2927 in 解析器实现
9KB
161 行
Rosa parse
Rosa parse 是一个命令行工具,可以将 stdin 中的 json、yaml 或 toml 转换为 stdout 中的 json、yaml 或 toml。
安装
cargo install rosa_parse
使用方法
Rosa parse 由三个二进制文件组成:to-toml
、to-yaml
、to-json
。
它们不接收任何参数,并期望从 stdin 接收 json、yaml 或 toml。
假设我们有一个以下 json 文件
{
"fruits": [
"apple",
"banana"
]
}
你可以将其转换为任何格式
-
转换为 toml
❯ to-toml < fruits.json fruits = ["apple", "banana"]
-
转换为 yaml
❯ to-yaml < fruits.json --- fruits: - apple - banana
-
再转换回 json
❯ to-json < fruits.json { "fruits": [ "apple", "banana" ] }
-
转换为 yaml 然后转换为 toml
❯ cat fruits.json | to-yaml | to-toml fruits = ["apple", "banana"]
许可
本仓库中的所有代码均在 MIT 许可证下发布,更多信息请查看 LICENSE 文件。
依赖关系
~2.2–3MB
~60K SLoC