Git Product home page Git Product logo

oq's Introduction

oq

Built with Crystal Build Status Latest release oq

A performant, portable jq wrapper thats facilitates the consumption and output of formats other than JSON; using jq filters to transform the data.

  • Compiles to a single binary for easy portability.
  • Performant, similar performance with JSON data compared to jq. Slightly longer execution time when going to/from a non-JSON format.
  • Supports XML and YAML as additional input/output formats.

Installation

Linux via snap

For more on installing & using snap with your Linux distribution, see the official documentation.

snap install oq

MacOS

brew tap blacksmoke16/tap
brew install oq

From Source

If building from source, jq will need to be installed separately. Installation instructions can be found in the official documentation.

Requires Crystal to be installed, see the installation documentation.

git clone https://github.com/Blacksmoke16/oq.git
cd oq/
shards build --production

The built binary will be available as ./bin/oq. This can be relocated elsewhere on your machine; be sure it is in your PATH to access it as oq.

Docker

oq can easily be included into a Docker image by fetching the static binary from Github for the version of oq that you want.

# Set an arg to store the oq version that should be installed.
ARG OQ_VERSION=1.0.0

# Grab the binary from the latest Github release and make it executable; placing it within /usr/local/bin.  Can also put it elsewhere if you so desire.
RUN wget https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-${OQ_VERSION}-linux-x86_64 -O /usr/local/bin/oq && chmod +x /usr/local/bin/oq

# Also be sure to install jq if it is not already!

Usage

CLI

Use the oq binary, with a few optional custom arguments, see oq --help. All other arguments get passed to jq. See jq manual for details.

Examples

Consume JSON and output XML

echo '{"name": "Jim"}' | oq -o xml .
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>Jim</name>
</root>

Consume YAML from a file and output XML

data.yaml

---
name: Jim
numbers:
  - 1
  - 2
  - 3
oq -i yaml -o xml . data.yaml 
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>Jim</name>
  <numbers>1</numbers>
  <numbers>2</numbers>
  <numbers>3</numbers>
</root>

Contributing

  1. Fork it (https://github.com/Blacksmoke16/oq/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

oq's People

Contributors

blacksmoke16 avatar nichtich avatar sprngr avatar

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.