增加了git功能,但是还未完善
This commit is contained in:
6
node_modules/minimisted/.bmp.yml
generated
vendored
Normal file
6
node_modules/minimisted/.bmp.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
version: 2.0.1
|
||||
commit: ":up: chore(version): bmp to v%.%.%"
|
||||
files:
|
||||
README.md: v%.%.%
|
||||
package.json: '"version": "%.%.%"'
|
||||
6
node_modules/minimisted/.editorconfig
generated
vendored
Normal file
6
node_modules/minimisted/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
root=true
|
||||
[*]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
trim_trailing_whitespace=true
|
||||
insert_final_newline=true
|
||||
13
node_modules/minimisted/.github/workflows/ci.yml
generated
vendored
Normal file
13
node_modules/minimisted/.github/workflows/ci.yml
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
name: CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12'
|
||||
- run: yarn
|
||||
- run: yarn cov
|
||||
- uses: codecov/codecov-action@v1
|
||||
58
node_modules/minimisted/README.md
generated
vendored
Normal file
58
node_modules/minimisted/README.md
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# minimisted v2.0.1
|
||||
|
||||

|
||||
[](https://codecov.io/gh/kt3k/minimisted)
|
||||
[](http://standardjs.com/)
|
||||
|
||||
> A handy wrapper of `minimist`
|
||||
|
||||
# Install
|
||||
|
||||
npm install minimisted
|
||||
|
||||
# Usage
|
||||
|
||||
You can write your cli like the following:
|
||||
|
||||
```js
|
||||
// Your cli's entry point
|
||||
const main = (argv) => {
|
||||
}
|
||||
|
||||
require('minimisted')(main)
|
||||
```
|
||||
|
||||
where `argv` is the command line options parsed by `minimist` i.e. `minimist(process.argv.slice(2))`.
|
||||
|
||||
Using object destructuring syntax, you can write it like the following:
|
||||
|
||||
```js
|
||||
/**
|
||||
* @param {boolean} help Shows help message if true
|
||||
* @param {boolean} version Shows the version if true
|
||||
* ...
|
||||
* @param {string[]} _ The parameters
|
||||
*/
|
||||
const main = ({ help, version, _ }) => {
|
||||
}
|
||||
|
||||
require('minimisted')(main)
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
```js
|
||||
const minimisted = require('minimisted')
|
||||
```
|
||||
|
||||
## minimisted(main[, opts[, argv]])
|
||||
|
||||
- @param {Function} main The main function
|
||||
- @param {Object} opts The option which is passed to minimist's 2rd arguments
|
||||
- @param {string} argv The command line arguments. Default is `process.argv.slice(2)`.
|
||||
|
||||
This calls `main` with command line options parsed by the minimist with the given options.
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
13
node_modules/minimisted/index.js
generated
vendored
Normal file
13
node_modules/minimisted/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Calls the given function with the minimist-parsed command line options and exit the process with the returned number of the main function.
|
||||
* @param {Function} main The main function of the cli
|
||||
* @param {Object} opts The options
|
||||
* @param {string[]} argv The command line arguments. Default is process.argv.slice(2).
|
||||
*/
|
||||
module.exports = (main, opts, argv) => {
|
||||
argv = argv || process.argv.slice(2)
|
||||
|
||||
return main(require('minimist')(argv, opts))
|
||||
}
|
||||
32
node_modules/minimisted/package.json
generated
vendored
Normal file
32
node_modules/minimisted/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "minimisted",
|
||||
"version": "2.0.1",
|
||||
"description": "Handy wrapper of `minimist`",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nyc": "^11.0.1",
|
||||
"standard": "^10.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"test": "node test.js",
|
||||
"cov": "nyc --reporter=lcov npm test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kt3k/minimisted.git"
|
||||
},
|
||||
"keywords": [
|
||||
"minimist",
|
||||
"cli"
|
||||
],
|
||||
"author": "Yoshiya Hinosawa <stibium121@gmail.com> (https://twitter.com/kt3k)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/kt3k/minimisted/issues"
|
||||
},
|
||||
"homepage": "https://github.com/kt3k/minimisted#readme"
|
||||
}
|
||||
16
node_modules/minimisted/test.js
generated
vendored
Normal file
16
node_modules/minimisted/test.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('assert')
|
||||
|
||||
const result = require('./')(argv => {
|
||||
assert.strictEqual(argv.foo, '1')
|
||||
assert.strictEqual(argv.bar, 'baz')
|
||||
assert.strictEqual(argv.qux, true)
|
||||
assert.deepStrictEqual(argv._, ['quux'])
|
||||
|
||||
return 123
|
||||
}, { string: ['foo'], boolean: ['qux'] }, ['--foo', '1', '--bar', 'baz', '--qux', 'quux'])
|
||||
|
||||
assert.strictEqual(result, 123)
|
||||
|
||||
console.log('test ok!')
|
||||
Reference in New Issue
Block a user