Comparing version 1.0.0 to 1.0.1
'use strict' | ||
const meow = require('meow') | ||
@@ -8,7 +7,10 @@ | ||
argv: process.argv.slice(2), | ||
help: false | ||
help: false, | ||
minimistOptions: {} | ||
}, opts) | ||
if (cli === undefined) { | ||
cli = meow(opts) | ||
const minimistOptions = opts.minimistOptions | ||
delete opts.minimistOptions | ||
cli = meow(opts, minimistOptions) | ||
} | ||
@@ -15,0 +17,0 @@ |
{ | ||
"name": "moggie", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "moggie wraps a lot meow to support subcommands.", | ||
@@ -24,2 +24,3 @@ "main": "index.js", | ||
"xo": { | ||
"esnext": true, | ||
"semicolon": false, | ||
@@ -26,0 +27,0 @@ "rules": { |
42
test.js
import test from 'ava' | ||
import meow from 'meow' | ||
@@ -45,1 +46,42 @@ import m from './' | ||
}) | ||
test.cb('adding minimistOptions should change minimist behavior', t => { | ||
m({ | ||
argv: ['foo', '--foo-bar', '-u', 'cat', '--', 'unicorn', 'cake'], | ||
minimistOptions: { | ||
'--': true | ||
}, | ||
subcommands: { | ||
foo: { | ||
callback: cli => { | ||
console.dir(cli) | ||
t.deepEqual(cli.flags['--'], ['unicorn', 'cake']) | ||
t.end(false) | ||
} | ||
} | ||
}, | ||
callback: () => t.end(true) | ||
}) | ||
}) | ||
test('meows double dash behavior', t => { | ||
const cli = meow({ | ||
argv: ['foo', '--foo-bar', '-u', 'cat', '--', 'unicorn', 'cake'], | ||
help: ` | ||
Usage | ||
foo <input> | ||
` | ||
}, { | ||
// alias: {u: 'unicorn'}, | ||
// default: {meow: 'dog'}, | ||
'--': true | ||
}) | ||
t.is(cli.input[0], 'foo') | ||
t.true(cli.flags.fooBar) | ||
// t.is(cli.flags.meow, 'dog') | ||
// t.is(cli.flags.unicorn, 'cat') | ||
t.deepEqual(cli.flags['--'], ['unicorn', 'cake']) | ||
t.is(cli.pkg.name, 'meow') | ||
console.dir(cli) | ||
}) |
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
137746
103