🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

stashed

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stashed

Handlebars templates for CLIs

latest
Source
npmnpm
Version
0.1.8
Version published
Weekly downloads
61
125.93%
Maintainers
1
Weekly downloads
 
Created
Source

stashed

Handlebars templates for CLIs! Now you can groom your stash on the command line too. Now with colors!

If you're building a CLI and want to keep the nasty string manipulations out your well crafted code, use this.

Usage

First add stashed to your deps or install manually:

npm i stashed

Next:

var stashed = require('stashed');
var render = stashed({
  templateDir: "./templates"
});

console.log(render('basics'));

console.log(render('with_binds',{
  answer: "two",
  name: "Rich"
}));

Inside ./templates/basics.hbs, you'll find:

{{#rainbow}}Skittles, taste the rainbow{{/rainbow}}

Which will render this in your terminal:

Rainbows!

Inside ./templates/with_binds.hbs, you'll find:

This template has some binds:

  1 + 1 = {{answer}}

Hello {{#inverse}}{{name}}{{/inverse}}!

This will render:

Binds

Options

render( <String::filename_of_template_wo_ext>, 
        [Object::context_object],
        [Boolean::strip_colors] )

Supported colors and styles

Stashed uses @marak's awesome colors.js. Stashed exposes colors.js' colors and styles as Handlebars block helpers:

  • bold
  • underline
  • italic
  • inverse
  • grey
  • black
  • yellow
  • red
  • green
  • blue
  • white
  • cyan
  • magenta
  • rainbow
  • zebra
  • zalgo

To use these, all you have to do is wrap your text with {{#style}}text{{/style}}. You can nest styles too.

Contribute

Go nuts, but don't forget to send me some pull requests!

Keywords

cli

FAQs

Package last updated on 18 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts