Skip to content

mattinsler/switchback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Installation

npm install switchback

Usage

Commands

Simple

var util = require('util')
  , switchback = require('switchback');

switchback.command('echo', function() {
  util.puts(Array.prototype.slice.call(arguments, 0).join(' '));
}).exec();

With description

switchback.command('echo', {
  description: 'This will echo back what you write',
  method: function() {
    util.puts(Array.prototype.slice.call(arguments, 0).join(' '));
  }
}).exec();

With scope

var foo = {bar: 'baz'};

switchback.command('foo', {
  scope: foo,
  description: 'Print out this.bar',
  method: function() {
    util.puts(this.bar);
  }
}).exec();

Namespaces

switchback.namespace('auth', function(switchback) {
  switchback.describe('Authentication methods')
  .command('login', {
    scope: auth_service,
    description: 'Login to service',
    method: auth_service.login
  })
  .command('logout', {
    scope: auth_service,
    description: 'Logout of service',
    method: auth_service.logout
  })
}).exec();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors