npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yaml-table

v1.1.3

Published

Converts yaml documents into ascii console tables.

Downloads

42

Readme

yaml-table

Yaml-table (written in ClojureScript but compiled to pure nodejs) converts yaml documents to console tables for easy displaying in your terminal. An example with one file:

$ yaml-table file1.yaml

+----+----+----+----+
| A  | B  | C  | D  |
+----+----+----+----+
| 11 | 12 | 15 | 16 |
+----+----+----+----+

An example with a directory full of yaml files:

$ yaml-table dir

+------------+----------+--------+------------+
|    Date    |  Range   |   Pr   | Expiration |
+------------+----------+--------+------------+
| 2016-01-04 | [-2, 20] |    0.9 |            |
| 2016-01-04 | [-2, 20] |    0.9 |            |
| 2016-01-07 |          |        |            |
| 2016-01-04 |          | [0, 3] |            |
| 2015-12-25 |  [-1, 2] |    0.8 |            |
| 2015-12-23 |   [0, 7] |    0.2 | 2015-12-23 |
| 2016-01-04 | [-∞, 12] |   0.12 | 2015-12-31 |
| 2015-12-28 |          |        |            |
+------------+----------+--------+------------+

You can customize table headers as well as which fields from your yaml files should be displayed. See below for configuration options.

Installation & Usage

To install, run:

npm install -g yaml-table

To use:

$ yaml-table <yaml_filename>

Or, to traverse the contents of a directory (and its subdirectories) for all yaml files:

$ yaml-table <directory>

Configuration

Create ~/.yaml-table in your home directory to configure yaml-table. This file is itself in the yaml format:

---
table: "dec-table"
file_extension: ".dec"
sort_field: "date"
options:
	skinny: true
	intersectionCharacter: "Y"
	columns:
		- 
		 field: "date"
		 name: "Date"
...
---
table: "table-name"
file_extension: ".yaml"
sort_field: "header1"
options:
	skinny: true
	intersectionCharacter: "X"
	columns:
		- 
		 field: "header1"
		 name: "Header 1"
		- 
		 field: "header2"
		 name: "Header 2"
		- 
		 field: "header3"
		 name: "Header 3"
		- 
		 field: "header4"
		 name: "Header 4"
		- 
		 field: "header5"
		 name: "Header 5"
...

Each yaml document -- encapsulated between "---" and "..." -- specifies a table and its fields and headers. Tables are given a name (accessed via -n in the command line), an extension (-e), and a number of rows (-r). You can also specifiy in ~/.yaml-table which field should be used to sort the table. These options default to -n default, -e .yaml, and -r 15 when left unspecified at the prompt.

Using the config above, a complete yaml-table command might look as follows:

$ yaml-table -e .yaml -n table-name -r 10 dir

+------------+------------+------------+------------+------------+
|  Header 1  |  Header 2  |  Header 3  |  Header 4  |  Header 5  |
+------------+------------+------------+------------+------------+
| asdf       | foo        |            |            | bar        |
| 22         |            |            |  55        | 1337       |
+------------+------------+------------+------------+------------+

TODO

  • Allow the display of nested fields.
  • Make yaml-table intelligently infer table headers from files (instead of forcing users to manually specify them within ~/.yaml-table)

This project is written in ClojureScript and compiled to pure nodejs via the Google Closure Compiler.