Skip to content

A simple tool for printing text in nice columns in the terminal.

Notifications You must be signed in to change notification settings

nlf/columnizer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

columnizer

A simple tool for printing text in nice columns in the terminal.

Installing

npm install columnizer

How do I use it?

var Columnizer = require('columnizer');


var stooges = [
  {name: "Larry", height: "short", fat: false},
  {name: "Curly", height: "medium or tall", fat: false},
  {name: "Moe", height: "tall", fat: true}
];

// create an object to start with
var example = new Columnizer;

// call it's row method and pass in agruments
// each subsequent argument is another column

// first we'll add some column headers
example.row("Name", "Height", "Girth");

// then add some data (and do some tweaking of that);
stooges.forEach(function (stooge) {
  example.row(stooge.name, stooge.height, (stooge.fat) ? "corpulent" : "skinny");
});

// then when we're ready, just print it out:
example.print();

// will print this:
/*
Name     Height            Girth        
Larry    short             skinny       
Curly    medium or tall    skinny       
Moe      tall              corpulent    
*/

Licence

MIT

About

A simple tool for printing text in nice columns in the terminal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%