Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including timbers with all npm packages installed. Try it out:

var timbers = require("timbers")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

timbers v1.0.0

Shiver me timbers! A tool to map short CLI argument to long CLI arguments


Argh! Shiver me timbers. The timbers library is a natural extension to argh. It allows you to easily transform short hand CLI flags into their long hand counter parts.


The package is published to npm and can be installed by running:

npm install --save timbers


const timbers = require('timbers');
const argh = require('argh');

const defaults = {
  cwd: process.cwd().
  foo: 'bar'

const args = timbers([
  '-c, --cwd'
], { ...defaults, ...argh.argv });


// { cwd: process.cwd(), foo: 'bar' }   // No values passed
// { cwd: 'bar', foo: 'bar' }           // -c bar
// { cwd: 'bar', foo: 'bar' }           // --cwd bar

While the library was designed with [argh] in mind, it will work with any object. It accepts the following arguments:

  • flags, Array, An array of strings that contain the mapping of short to long flags. For example: -r, --require. You can also map multiple short flags to a long flag: -r, -e, --require.
  • arg, Object, Object with values that should be used as data source.


MIT [argh]:

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free