Comparing version 2.0.0 to 2.1.0
15
index.js
@@ -27,2 +27,5 @@ 'use strict'; | ||
// custom data for each command | ||
this.commandOptions = {}; | ||
this.middleware = []; | ||
@@ -43,4 +46,10 @@ this.commands = {}; | ||
Sushi.prototype.command = function (name, fn) { | ||
Sushi.prototype.command = function (name, options, fn) { | ||
if (typeof options === 'function') { | ||
fn = options; | ||
options = {}; | ||
} | ||
this.commands[name] = fn; | ||
this.commandOptions[name] = options; | ||
@@ -68,6 +77,8 @@ return this; | ||
var command = this.commands[name]; | ||
var command = this.commands[name] || null; | ||
var options = this.commandOptions[name] || {}; | ||
var req = { | ||
command: command, | ||
options: options, | ||
context: {}, | ||
@@ -74,0 +85,0 @@ argv: argv, |
{ | ||
"name": "sushi", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Express for CLI apps", | ||
@@ -9,3 +9,4 @@ "author": "Vadim Demedes <vdemedes@gmail.com>", | ||
"scripts": { | ||
"test": "xo && ava" | ||
"test": "xo && nyc ava", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
@@ -19,3 +20,5 @@ "dependencies": { | ||
"ava": "^0.12.0", | ||
"coveralls": "^2.11.8", | ||
"eslint-config-vdemedes": "^1.0.2", | ||
"nyc": "^5.6.0", | ||
"xo": "^0.12.1" | ||
@@ -22,0 +25,0 @@ }, |
# sushi | ||
[![Build Status](https://travis-ci.org/vdemedes/sushi.svg?branch=master)](https://travis-ci.org/vdemedes/sushi) | ||
[![Coverage Status](https://coveralls.io/repos/github/vdemedes/sushi/badge.svg?branch=master)](https://coveralls.io/github/vdemedes/sushi?branch=master) | ||
@@ -165,2 +166,9 @@ Express-like framework for CLI apps. | ||
## List of middleware | ||
Here's the list of middleware you can use with Sushi: | ||
- [help](https://github.com/vdemedes/sushi-help) - help messages | ||
## Tests | ||
@@ -167,0 +175,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6690
86
183
5