mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-16 23:33:38 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
81
node_modules/dargs/index.js
generated
vendored
Normal file
81
node_modules/dargs/index.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
var numberIsNan = require('number-is-nan');
|
||||
|
||||
function createArg(key, val, separator) {
|
||||
key = key.replace(/[A-Z]/g, '-$&').toLowerCase();
|
||||
return '--' + key + (val ? separator + val : '');
|
||||
}
|
||||
|
||||
function match(arr, val) {
|
||||
return arr.some(function (x) {
|
||||
return x instanceof RegExp ? x.test(val) : x === val;
|
||||
});
|
||||
}
|
||||
|
||||
function createAliasArg(key, val) {
|
||||
return '-' + key + (val ? ' ' + val : '');
|
||||
}
|
||||
|
||||
module.exports = function (input, opts) {
|
||||
var args = [];
|
||||
var extraArgs = [];
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
var separator = opts.useEquals === false ? ' ' : '=';
|
||||
|
||||
Object.keys(input).forEach(function (key) {
|
||||
var val = input[key];
|
||||
var argFn = createArg;
|
||||
|
||||
if (Array.isArray(opts.excludes) && match(opts.excludes, key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Array.isArray(opts.includes) && !match(opts.includes, key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof opts.aliases === 'object' && opts.aliases[key]) {
|
||||
key = opts.aliases[key];
|
||||
argFn = createAliasArg;
|
||||
}
|
||||
|
||||
if (key === '_') {
|
||||
if (!Array.isArray(val)) {
|
||||
throw new TypeError('Expected key \'_\' to be an array, but found ' + (typeof val));
|
||||
}
|
||||
|
||||
extraArgs = val;
|
||||
return;
|
||||
}
|
||||
|
||||
if (val === true) {
|
||||
args.push(argFn(key, ''));
|
||||
}
|
||||
|
||||
if (val === false && !opts.ignoreFalse) {
|
||||
args.push(argFn('no-' + key));
|
||||
}
|
||||
|
||||
if (typeof val === 'string') {
|
||||
args.push(argFn(key, val, separator));
|
||||
}
|
||||
|
||||
if (typeof val === 'number' && !numberIsNan(val)) {
|
||||
args.push(argFn(key, String(val), separator));
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
val.forEach(function (arrVal) {
|
||||
args.push(argFn(key, arrVal, separator));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
extraArgs.forEach(function (extraArgVal) {
|
||||
args.push(String(extraArgVal));
|
||||
});
|
||||
|
||||
return args;
|
||||
};
|
||||
21
node_modules/dargs/license
generated
vendored
Normal file
21
node_modules/dargs/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
51
node_modules/dargs/package.json
generated
vendored
Normal file
51
node_modules/dargs/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "dargs",
|
||||
"version": "4.1.0",
|
||||
"description": "Reverse minimist. Convert an object of options into an array of command-line arguments.",
|
||||
"repository": "sindresorhus/dargs",
|
||||
"keywords": [
|
||||
"options",
|
||||
"arguments",
|
||||
"args",
|
||||
"flags",
|
||||
"cli",
|
||||
"nopt",
|
||||
"minimist",
|
||||
"bin",
|
||||
"binary",
|
||||
"command",
|
||||
"cmd",
|
||||
"reverse",
|
||||
"inverse",
|
||||
"opposite",
|
||||
"invert",
|
||||
"switch",
|
||||
"construct",
|
||||
"parse",
|
||||
"parser",
|
||||
"argv"
|
||||
],
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"dependencies": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"array-equal": "^1.0.0",
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
||||
148
node_modules/dargs/readme.md
generated
vendored
Normal file
148
node_modules/dargs/readme.md
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
# dargs [](https://travis-ci.org/sindresorhus/dargs)
|
||||
|
||||
> Reverse [`minimist`](https://github.com/substack/minimist). Convert an object of options into an array of command-line arguments.
|
||||
|
||||
Useful when spawning command-line tools.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save dargs
|
||||
```
|
||||
|
||||
|
||||
#### Usage
|
||||
|
||||
```js
|
||||
const dargs = require('dargs');
|
||||
|
||||
const input = {
|
||||
_: ['some', 'option'], // values in '_' will be appended to the end of the generated argument list
|
||||
foo: 'bar',
|
||||
hello: true, // results in only the key being used
|
||||
cake: false, // prepends `no-` before the key
|
||||
camelCase: 5, // camelCase is slugged to `camel-case`
|
||||
multiple: ['value', 'value2'], // converted to multiple arguments
|
||||
pieKind: 'cherry',
|
||||
sad: ':('
|
||||
};
|
||||
|
||||
const excludes = ['sad', /.*Kind$/]; // excludes and includes accept regular expressions
|
||||
const includes = ['camelCase', 'multiple', 'sad', /^pie.*/];
|
||||
const aliases = {file: 'f'};
|
||||
|
||||
console.log(dargs(input, {excludes: excludes}));
|
||||
/*
|
||||
[
|
||||
'--foo=bar',
|
||||
'--hello',
|
||||
'--no-cake',
|
||||
'--camel-case=5',
|
||||
'--multiple=value',
|
||||
'--multiple=value2',
|
||||
'some',
|
||||
'option'
|
||||
]
|
||||
*/
|
||||
|
||||
console.log(dargs(input, {
|
||||
excludes: excludes,
|
||||
includes: includes
|
||||
}));
|
||||
/*
|
||||
[
|
||||
'--camel-case=5',
|
||||
'--multiple=value',
|
||||
'--multiple=value2'
|
||||
]
|
||||
*/
|
||||
|
||||
|
||||
console.log(dargs(input, {includes: includes}));
|
||||
/*
|
||||
[
|
||||
'--camel-case=5',
|
||||
'--multiple=value',
|
||||
'--multiple=value2',
|
||||
'--pie-kind=cherry',
|
||||
'--sad=:('
|
||||
]
|
||||
*/
|
||||
|
||||
|
||||
console.log(dargs({
|
||||
foo: 'bar',
|
||||
hello: true,
|
||||
file: 'baz'
|
||||
}, {
|
||||
aliases: aliases
|
||||
}));
|
||||
/*
|
||||
[
|
||||
'--foo=bar',
|
||||
'--hello',
|
||||
'-f baz'
|
||||
]
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### dargs(input, [options])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `object`
|
||||
|
||||
Object to convert to command-line arguments.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### excludes
|
||||
|
||||
Type: `array`
|
||||
|
||||
Keys or regex of keys to exclude. Takes precedence over `includes`.
|
||||
|
||||
##### includes
|
||||
|
||||
Type: `array`
|
||||
|
||||
Keys or regex of keys to include.
|
||||
|
||||
##### aliases
|
||||
|
||||
Type: `object`
|
||||
|
||||
Maps keys in `input` to an aliased name. Matching keys are converted to options with a single dash ("-") in front of the aliased name and a space separating the aliased name from the value. Keys are still affected by `includes` and `excludes`.
|
||||
|
||||
##### useEquals
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Setting to `false` switches the separator in generated commands from an equals sign `=` to a single space ` `. For example:
|
||||
|
||||
```js
|
||||
console.log(dargs({foo: 'bar'}, {useEquals: false}));
|
||||
/*
|
||||
[
|
||||
'--foo bar'
|
||||
]
|
||||
*/
|
||||
```
|
||||
|
||||
##### ignoreFalse
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Don't include `false` values. This is mostly useful when dealing with strict argument parsers that would throw on unknown arguments like `--no-foo`.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user