GithubHelp home page GithubHelp logo

yoshihitoh / refmt Goto Github PK

View Code? Open in Web Editor NEW
27.0 1.0 1.0 1.02 MB

Translate data format into another one. Currently only JSON and YAML are available.

License: MIT License

Rust 98.76% Shell 1.24%
converter json yaml utility cli command-line command-line-tool

refmt's Introduction

refmt

Build Status

refmt is a data format translation tool written in Rust. Currently only JSON, YAML and TOML are available.

Syntax highlighting

refmt supports syntax highlighting.

Syntax highlighting example

Installation

refmt is written ins Rust, so you need Rust toolchains. refmt compiled with Rust 1.30.0 (stable) or newer.

To build refmt:

$ git clone https://github.com/yoshihitoh/refmt
$ cd refmt
$ cargo build --release
$ ./target/release/refmt --version
refmt 0.1.2

Usage

$ ./target/release/refmt --help
refmt 0.1.2
yoshihitoh <[email protected]>
Translate data format into another one.

USAGE:
    refmt [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -i, --input <FILE>                   set the input file to use
        --input-format <FORMAT_NAME>     set the name of input format [possible values: json, yaml]
    -o, --output <FILE>                  set the output file to use
        --output-format <FORMAT_NAME>    set the name of output format [possible values: json, yaml]

Examples

JSON to YAML

$ echo '{"id": 1, "name": {"first": "John", "last": "Doe"}}' | ./target/release/refmt --input-format json --output-format yaml
---
id: 1
name:
  first: John
  last: Doe

YAML to JSON

$ cat <<EOS | ./target/release/refmt --input-format yaml --output-format json
> ---
> id: 1
> name:
>   first: John
>   last: Doe
> EOS
{
  "id": 1,
  "name": {
    "first": "John",
    "last": "Doe"
  }
}

JSON to TOML

$ echo '{"id": 1, "name": {"first": "John", "last": "Doe"}}' | refmt --input-format json --output-format toml
id = 1

[name]
first = 'John'
last = 'Doe'

Running tests

$ cargo test --all

refmt's People

Contributors

yoshihitoh avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

yibit avatar Tuan Duc Tran avatar Andrew NS Yeow avatar clark avatar  avatar Sankalp Ranade avatar The web walker avatar Andreas Ellwanger avatar Zhao Xiaohong avatar Xargin avatar yicheny avatar zbv avatar Eason Chai avatar messense avatar Chojan Shang avatar Cheng JIANG avatar yvt avatar Yuki Okushi avatar YOSHIOKA Takuma avatar yT avatar Joseph Melfi avatar Kristjan Siimson avatar Hendrik Maus avatar Matt Sawyer avatar Adriano Santos avatar Mike Roberts avatar  avatar

Watchers

 avatar

Forkers

isgasho

refmt's Issues

Improve behaviours

Problems

  • cannot use reser for syntax checking
  • cannot infer file format from ambiguous file extensions (e.g yaml, yml)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.