Introduction

gq is a command line filter (à la sed/awk) used for rendering Go templates, along with a few other useful data transformation features. It is heavily inspired by Kubectl and Helm.

Features

  • Go template rendering (Sprig functions included)
  • JSONPath querying (using Kubectl syntax)
  • Data format transformation
  • Line-based processing and whole-input processing

Install

Manual

Download the binary from the GitHub Releases page and place it on your path.

Go

Run the following command. Make sure you have $GOPATH/bin on your $PATH.

go get github.com/pbar1/gq

Docker

TODO

Quick Start

Fetch a GitHub repo's tags and parse the response:

curl --silent https://api.github.com/repos/torvalds/linux/git/refs/tags \
| gq -r 'printf "%s -> %s\n" (.ref | replace "refs/tags/" "") .object.sha'