Git Product home page Git Product logo

hoconvert's Introduction

{hocon:vert}

CLI Tool to convert HOCON into valid JSON or YAML.

Under normal circumstances this is mostly not needed because hocon configs are parsed within the application โ€“ case closed. But for example in conjunction with Kubernetes where .conf files can reside in ConfigMaps there was that need to extract information on command line from time to time. And what would be more comfortable than to use jq for this.

Usage

hoconvert [input | --file <path>] [--output (yaml|json)]

Either provide the hocon as first argument:

hoconvert "foo = bar"

or provide it from stdin,

echo "foo = bar" | hoconvert

which leads to the following output:

{
  "foo": "bar"
}

You can also read the hocon from a file by providing the path:

hoconvert -f config.hocon

Here is an example of a real-life Kubernetes problem as stated above:

kubectl get cm <any ConfigMap> -o jsonpath='{.data.myHocon}' | jq -r | hoconvert | jq '.doWhatEverYouWant'

Installation

Install with homebrew

In case you use brew you can install hoconvert as follows:

brew tap maoertel/tap
brew install hoconvert

You can install from brew for the following architectures: macOS/amd64, macOS/arm64 or linux/amd64.

Download the binary

You can download a binary of the latest release currently for macOS/amd64, macOS/arm64 and linux/amd64.

Install with cargo

In case you have cargo installed this is the easiest way to install hoconvert from crates.io in match to your underlying architecture:

cargo install hoconvert

Build it yourself

Check this repo out, change into the project directory and run:

cargo build --release

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.