Comparing version 1.7.1 to 1.7.2
@@ -9,4 +9,4 @@ /** | ||
const find = (argv, long, short, bool = false, number = false) => { | ||
const re = short ? new RegExp(`^-(${short}|-${long})`) | ||
: new RegExp(`^--${long}`) | ||
const re = short ? new RegExp(`^-(${short}|-${long})$`) | ||
: new RegExp(`^--${long}$`) | ||
const i = argv.findIndex(a => re.test(a)) | ||
@@ -76,3 +76,3 @@ if (i == -1) return { argv } | ||
*/ | ||
function argufy(config = {}, args = process.argv) { | ||
function argufy(config = {}, args = process.argv) { | ||
let [, , ...argv] = args | ||
@@ -133,3 +133,3 @@ const titles = findTitles(argv) | ||
*/ | ||
const reduceUsage = (argsConfig) => { | ||
const reduceUsage = (argsConfig) => { | ||
const a = Object.keys(argsConfig).reduce((acc, key) => { | ||
@@ -136,0 +136,0 @@ const val = argsConfig[key] |
/** @param {!Array<_argufy.Flag>} flags */ | ||
const serialiseFlags = (flags) => { | ||
const serialiseFlags = (flags) => { | ||
let obj = flags.map(({ | ||
@@ -45,3 +45,3 @@ name, short, boolean, number, command, multiple, description, default: def, | ||
*/ | ||
const makeExports = (args, lastVarArgsName, argsName = '') => { | ||
const makeExports = (args, lastVarArgsName, argsName = '') => { | ||
const obj = serialiseFlags(args) | ||
@@ -48,0 +48,0 @@ const varConfigName = `argsConfig${argsName}` |
@@ -0,1 +1,7 @@ | ||
## 7 December 2019 | ||
### [1.7.2](https://github.com/artdecocode/argufy/compare/v1.7.1...v1.7.2) | ||
- [fix] Add the missing `$` to the regex. | ||
## 16 July 2019 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "argufy", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "Parses Command Line Arguments To Node.JS CLI Programs, Keeps Them In Arguments.xml File To Paste Into README Documentation And Generate Google Closure Compatible Exports.", | ||
@@ -14,4 +14,4 @@ "main": "build", | ||
"lint": "eslint .", | ||
"doc": "NODE_DEBUG=doc doc -o README.md", | ||
"compile": "depack-dev src/argufy -p -c -a -o depack -s --externs externs.js", | ||
"doc": "NODE_DEBUG=doc doc -o README.md -n _argufy", | ||
"compile": "depack src/argufy -p -c -a -o compile -s --externs types/externs.js", | ||
"d": "yarn-s d1 externs", | ||
@@ -25,13 +25,13 @@ "d1": "typal src/index.js -c", | ||
"args": "alanode getargs", | ||
"argufy": "depack/argufy.js", | ||
"argufy": "compile/argufy.js", | ||
"dev": "alanode src/argufy" | ||
}, | ||
"bin": "depack/argufy.js", | ||
"bin": "compile/argufy.js", | ||
"files": [ | ||
"build", | ||
"src", | ||
"externs.js", | ||
"depack" | ||
"types/externs.js", | ||
"compile" | ||
], | ||
"externs": "externs.js", | ||
"externs": "types/externs.js", | ||
"repository": { | ||
@@ -52,12 +52,14 @@ "type": "git", | ||
"@artdeco/clean-stack": "^1.1.1", | ||
"alamode": "^2.3.4", | ||
"alamode": "^3.2.0", | ||
"catchment": "^3.3.0", | ||
"documentary": "^1.27.4", | ||
"rexml": "^2.0.2", | ||
"depack": "^1.0.1", | ||
"documentary": "^1.34.1", | ||
"erte": "^1.2.0", | ||
"rexml": "^2.2.2", | ||
"temp-context": "^2.1.3", | ||
"usually": "^1.2.0", | ||
"yarn-s": "1.1.0", | ||
"zoroaster": "^4.1.1-alpha" | ||
"yarn-s": "1.2.1", | ||
"zoroaster": "^4.1.2" | ||
}, | ||
"dependencies": {} | ||
} |
# argufy | ||
[![npm version](https://badge.fury.io/js/argufy.svg)](https://npmjs.org/package/argufy) | ||
[![npm version](https://badge.fury.io/js/argufy.svg)](https://www.npmjs.com/package/argufy) | ||
@@ -11,3 +11,5 @@ ```sh | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/0.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/0.svg?sanitize=true"> | ||
</a></p> | ||
@@ -25,8 +27,10 @@ ## Table Of Contents | ||
* [`argufy(config: Config, argv?: string[]): Object`](#argufyconfig-configargv-string-object) | ||
* [`_argufy.Config`](#type-_argufyconfig) | ||
* [`_argufy.Flag`](#type-_argufyflag) | ||
* [`Config`](#type-config) | ||
* [`Flag`](#type-flag) | ||
* [`reduceUsage(config: Config): Object`](#reduceusageconfig-config-object) | ||
- [Copyright](#copyright) | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/1.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/1.svg?sanitize=true"> | ||
</a></p> | ||
@@ -179,3 +183,5 @@ ## CLI | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/2.svg?sanitize=true" width="20"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/2.svg?sanitize=true" width="20"> | ||
</a></p> | ||
@@ -185,20 +191,35 @@ ### Argufy Arguments | ||
<table> | ||
<tr><th>Argument</th><th>Short</th><th>Description</th></tr> | ||
<thead> | ||
<tr> | ||
<td>input</td> | ||
<td></td> | ||
<td> | ||
The location of the <code>arguments.xml</code> file. Default <code>types/arguments.xml</code>. | ||
</td> | ||
<th>Argument</th> | ||
<th>Short</th> | ||
<th>Description</th> | ||
</tr> | ||
<tr><td>--output</td><td>-o</td><td> | ||
The destination where to save output. | ||
If not passed, prints to stdout. | ||
</td> | ||
</thead> | ||
<tr> | ||
<td>input</td> | ||
<td></td> | ||
<td>The location of the <code>arguments.xml</code> file. Default <code>types/arguments.xml</code>.</td> | ||
</tr> | ||
<tr><td>--help</td><td>-h</td><td>Print the help information and exit.</td></tr> | ||
<tr><td>--version</td><td>-v</td><td>Show the version's number and exit.</td></tr> | ||
<tr> | ||
<td>--output</td> | ||
<td>-o</td> | ||
<td>The destination where to save output. | ||
If not passed, prints to stdout.</td> | ||
</tr> | ||
<tr> | ||
<td>--help</td> | ||
<td>-h</td> | ||
<td>Print the help information and exit.</td> | ||
</tr> | ||
<tr> | ||
<td>--version</td> | ||
<td>-v</td> | ||
<td>Show the version's number and exit.</td> | ||
</tr> | ||
</table> | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/3.svg?sanitize=true" width="20"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/3.svg?sanitize=true" width="20"> | ||
</a></p> | ||
@@ -273,3 +294,5 @@ ### Multiple Input Files | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/4.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/4.svg?sanitize=true"> | ||
</a></p> | ||
@@ -286,5 +309,7 @@ ## API | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/5.svg?sanitize=true" width="20"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/5.svg?sanitize=true" width="20"> | ||
</a></p> | ||
### `argufy(`<br/> `config: Config,`<br/> `argv?: string[],`<br/>`): Object` | ||
### <code><ins>argufy</ins>(</code><sub><br/> `config: Config,`<br/> `argv?: string[],`<br/></sub><code>): <i>Object</i></code> | ||
@@ -316,5 +341,5 @@ The flags from the arguments will be extracted according to the configuration object and the arguments array. If arguments array is not passed, `process.argv` is used to find arguments. | ||
```sh | ||
node example.js --title "Hello World" -w 10 -l -app Argufy | ||
node example.js --title "Hello World" -w 10 -l --app Argufy | ||
# or | ||
node example.js HelloWorld -w 10 -l -app Argufy | ||
node example.js HelloWorld -w 10 -l --app Argufy | ||
``` | ||
@@ -334,5 +359,5 @@ | ||
`Object<string, string|!_argufy.Flag>` __<a name="type-_argufyconfig">`_argufy.Config`</a>__: The configuration for parsing, where each key is a flag name and values are either strings, or objects with possible properties: | ||
<code>Object<string, (string \| <a href="#type-flag" title="The flag passed to the program.">!Flag</a>)></code> __<a name="type-config">`Config`</a>__: The configuration for parsing, where each key is a flag name and values are either strings, or objects with possible properties: | ||
__<a name="type-_argufyflag">`_argufy.Flag`</a>__: The flag passed to the program. | ||
__<a name="type-flag">`Flag`</a>__: The flag passed to the program. | ||
@@ -349,5 +374,7 @@ | Name | Type | Description | Default | | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/6.svg?sanitize=true" width="20"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/6.svg?sanitize=true" width="20"> | ||
</a></p> | ||
### `reduceUsage(`<br/> `config: Config,`<br/>`): Object` | ||
### <code><ins>reduceUsage</ins>(</code><sub><br/> `config: Config,`<br/></sub><code>): <i>Object</i></code> | ||
@@ -369,3 +396,5 @@ Given the _Argufy_ config, creates an object that can be passed to [_Usually_](https://artdecocode.com/usually/). Can be used to reduce the config auto-generated and exported from the JavaScript file with the CLI. | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/7.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/7.svg?sanitize=true"> | ||
</a></p> | ||
@@ -378,3 +407,4 @@ ## Copyright | ||
<a href="https://artd.eco"> | ||
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco"> | ||
<img width="100" src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" | ||
alt="Art Deco"> | ||
</a> | ||
@@ -385,3 +415,3 @@ </th> | ||
<a href="https://www.technation.sucks" title="Tech Nation Visa"> | ||
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif" | ||
<img width="100" src="https://raw.githubusercontent.com/idiocc/cookies/master/wiki/arch4.jpg" | ||
alt="Tech Nation Visa"> | ||
@@ -394,2 +424,4 @@ </a> | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/-1.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/-1.svg?sanitize=true"> | ||
</a></p> |
@@ -9,4 +9,4 @@ /** | ||
const find = (argv, long, short, bool = false, number = false) => { | ||
const re = short ? new RegExp(`^-(${short}|-${long})`) | ||
: new RegExp(`^--${long}`) | ||
const re = short ? new RegExp(`^-(${short}|-${long})$`) | ||
: new RegExp(`^--${long}$`) | ||
const i = argv.findIndex(a => re.test(a)) | ||
@@ -13,0 +13,0 @@ if (i == -1) return { argv } |
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
414
62862
11
854