gutenfmt

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2022 License: Apache-2.0

README

gutenfmt

gutenfmt is a cross-platform command line tool that converts name-value pairs and JSON to different output formats,
including, but not limited to, CSV, JSON, YAML or a table with aligned columns.

abc-inc.github.io/gutenfmt

Examples

The following examples provide a brief overview of gutenfmt and its features.

List OpenJDK Packages on a Debian-System as Colorized JSON

$ dpkg-query -W -f='${Package}\t${Version}\t${Status}\n' "openjdk*" | grep -Fv unknown | cut -f 1,2 | gutenfmt

{
  "openjdk-16-jdk": "16.0.2+7-2",
  "openjdk-16-jdk-headless": "16.0.2+7-2",
  "openjdk-16-jre": "16.0.2+7-2",
  "openjdk-16-jre-headless": "16.0.2+7-2",
  "openjdk-16-source": "16.0.2+7-2",
  "openjdk-8-jdk": "8u302-b08-0ubuntu2",
  "openjdk-8-jdk-headless": "8u302-b08-0ubuntu2",
  "openjdk-8-jre": "8u302-b08-0ubuntu2",
  "openjdk-8-jre-headless": "8u302-b08-0ubuntu2"
}

Print JavaScript Dependencies as Table With Aligned Columns

$ jq '.dependencies' package.json | tr -d '" ,' | gutenfmt -o text | sort

...
@types/yargs                         ^17.0.3
@webcomponents/custom-elements       ^1.1.0
xhr2                                 0.2.1
yargs                                ^17.2.1

Further Information

gutenfmt is a also a Go library that helps to create applications, which support different output formats. It comes with an opinionated view of the third-party libraries, so that you can get started with minimum fuss. In other words, Formatters come with meaningful defaults.

The primary goals are:

  • Provide a radically faster and widely accessible getting-started experience for Command Line Interface (CLI) development.
  • Be opinionated out of the box but get out of the way quickly as requirements start to diverge from the defaults.
  • Provide a range of standardized output formats that are common to state-of-the-art projects.

Both, User Manual and Development Guide, can be found at abc-inc.github.io/gutenfmt.

Directories

Path Synopsis
cmd
Package formatter provides various implementations to convert arbitrary values to different string representations such as JSON.
Package formatter provides various implementations to convert arbitrary values to different string representations such as JSON.
internal
json
Package json encapsulates JSON processing and enables gutenfmt to work with different JSON libraries, when being used as a library.
Package json encapsulates JSON processing and enables gutenfmt to work with different JSON libraries, when being used as a library.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL