Comparing version 1.1.0 to 1.2.0
/** | ||
* Generate a usage string. | ||
* @param {Config} config | ||
* @param {Object<string, string>} config.usage The map with possible arguments (flags, options) and their information. | ||
* @param {!_usually.Config} config The configuration object. | ||
* @param {!Object<string, string>} config.usage The map with possible arguments (flags, options) and their information. | ||
* @param {string} [config.description] What does the program do? | ||
* @param {string} [config.line] The summary of the program in one line. | ||
* @param {string} [config.example] The Example of the program usage. | ||
* @param {string} [config.example] The example of the program usage. | ||
* @example | ||
* // Get the usage string and print it. | ||
* import usually from '../src' | ||
* | ||
* const res = usually({ | ||
* usage: { | ||
* '-h': 'print help', | ||
* '-c': 'execute this command', | ||
* }, | ||
* description: 'A test command-line application', | ||
* line: 'usually [-c command|command2] [-h]', | ||
* example: 'usually -c command2', | ||
* }) | ||
* | ||
* console.log(res) | ||
* | ||
* // A test command-line application | ||
* // | ||
* // usually [-c command|command2] [-h] | ||
* // | ||
* // -h print help | ||
* // -c execute this command | ||
* // | ||
* // Example: | ||
* // | ||
* // usually -c command2 | ||
* // | ||
``` | ||
import usually from 'usually' | ||
const res = usually({ | ||
usage: { | ||
'-h': 'print help', | ||
'-c': 'execute this command', | ||
}, | ||
description: 'A test command-line application', | ||
line: 'usually [-c command|command2] [-h]', | ||
example: 'usually -c command2', | ||
}) | ||
// A test command-line application | ||
// | ||
// usually [-c command|command2] [-h] | ||
// | ||
// -h print help | ||
// -c execute this command | ||
// | ||
// Example: | ||
// | ||
// usually -c command2 | ||
// | ||
``` | ||
*/ | ||
function usually(config = {}) { | ||
function usually(config = { usage: {} }) { | ||
const { | ||
@@ -47,3 +45,2 @@ usage = {}, | ||
const [commandLength] = commands.reduce(([longestName = 0, longestDescription = 0], name) => { | ||
/** @type {string} */ | ||
const command = usage[name] | ||
@@ -105,7 +102,12 @@ const theLongest = command.split('\n') | ||
/** | ||
* @typedef {Object} Config | ||
* @prop {Object<string, string>} usage The map with possible arguments (flags, options) and their information. | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {_usually.Config} Config The configuration object. | ||
*/ | ||
/** | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {Object} _usually.Config The configuration object. | ||
* @prop {!Object<string, string>} usage The map with possible arguments (flags, options) and their information. | ||
* @prop {string} [description] What does the program do? | ||
* @prop {string} [line] The summary of the program in one line. | ||
* @prop {string} [example] The Example of the program usage. | ||
* @prop {string} [example] The example of the program usage. | ||
*/ | ||
@@ -112,0 +114,0 @@ |
@@ -0,1 +1,10 @@ | ||
## 12 April 2019 | ||
### [1.2.0](https://github.com/artdecocode/usually/compare/v1.1.0...v1.2.0) | ||
- [externs] Generate externs for _Google Closure Compiler_ via _Depack_ withing `_usually_ namespace. | ||
- [doc] Doc integration with _Argufy_. | ||
- [deps] Update and unlock dev dependencies. | ||
- [package] Export `module`. | ||
## 4 Dec 2018 | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "usually", | ||
"version": "1.1.0", | ||
"description": "Print usage of a Node.js command-line application.", | ||
"main": "build", | ||
"version": "1.2.0", | ||
"description": "Prints Usage For Node.JS Command-Line Applications.", | ||
"main": "build/index.js", | ||
"module": "src/index.js", | ||
"scripts": { | ||
@@ -13,12 +14,16 @@ "t": "zoroaster -a", | ||
"lint": "eslint .", | ||
"e": "node example", | ||
"e": "alanode", | ||
"example/": "yarn e example/example.js", | ||
"doc": "NODE_DEBUG=doc doc documentary -o README.md", | ||
"d": "yarn-s d1", | ||
"d1": "doc src/index.js -g", | ||
"d": "yarn-s d1 externs", | ||
"d1": "typal src/index.js -c", | ||
"externs": "typal externs.js -e", | ||
"build": "yarn-s d b doc", | ||
"b": "alamode src -o build -s" | ||
}, | ||
"externs": "externs.js", | ||
"files": [ | ||
"build" | ||
"build", | ||
"src", | ||
"externs.js" | ||
], | ||
@@ -44,10 +49,9 @@ "repository": { | ||
"devDependencies": { | ||
"alamode": "1.6.0", | ||
"documentary": "1.20.1", | ||
"eslint": "4.19.1", | ||
"eslint-config-artdeco": "1.0.0", | ||
"snapshot-context": "2.0.1", | ||
"alamode": "^1.9.3", | ||
"documentary": "^1.23.4", | ||
"eslint-config-artdeco": "1.0.1", | ||
"snapshot-context": "^2.2.2", | ||
"yarn-s": "1.1.0", | ||
"zoroaster": "3.6.6" | ||
"zoroaster": "^3.11.5" | ||
} | ||
} |
@@ -5,9 +5,6 @@ # usually | ||
`usually` Will Generate Usage Of A Node.js Command-Line Application. | ||
_Usually_ Will Generate Usage Of Node.JS Command-Line Applications. It is compatible with [_Argufy_](https://artdecocode.com/argufy/) which can save arguments in the `arguments.xml` file, and extract them with auto-generated JavaScript compatible with _Google Closure Compiler_. | ||
```sh | ||
yarn add -E usually | ||
# or with npm.sucks | ||
npm i usually | ||
``` | ||
@@ -23,4 +20,5 @@ | ||
- [`usually(config: Config): string`](#usuallyconfig-config-string) | ||
* [`Config`](#type-config) | ||
- [Licence](#licence) | ||
* [`_usually.Config`](#type-_usuallyconfig) | ||
- [Argufy Integration](#argufy-integration) | ||
- [Copyright](#copyright) | ||
@@ -35,8 +33,6 @@ <p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/1.svg?sanitize=true"></a></p> | ||
import usually from 'usually' | ||
``` | ||
// or | ||
The types and [externs](externs.js) for _Google Closure Compiler_ via [**_Depack_**](https://github.com/dpck/depack) are defined in the `_usually` namespace. | ||
const usually = require('usually') | ||
``` | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/2.svg?sanitize=true"></a></p> | ||
@@ -48,10 +44,10 @@ | ||
__<a name="type-config">`Config`</a>__ | ||
__<a name="type-_usuallyconfig">`_usually.Config`</a>__: The configuration object. | ||
| Name | Type | Description | | ||
| ----------- | ------------------------------ | ----------------------------------------------------------------------- | | ||
| __usage*__ | _Object<string, string>_ | The map with possible arguments (flags, options) and their information. | | ||
| description | _string_ | What does the program do? | | ||
| line | _string_ | The summary of the program in one line. | | ||
| example | _string_ | The Example of the program usage. | | ||
| Name | Type | Description | | ||
| ----------- | ------------------------------- | ----------------------------------------------------------------------- | | ||
| __usage*__ | _!Object<string, string>_ | The map with possible arguments (flags, options) and their information. | | ||
| description | _string_ | What does the program do? | | ||
| line | _string_ | The summary of the program in one line. | | ||
| example | _string_ | The example of the program usage. | | ||
@@ -114,12 +110,16 @@ ```js | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/11.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/3.svg?sanitize=true"></a></p> | ||
## Licence | ||
## Argufy Integration | ||
(c) [Art Deco][1] 2018 | ||
_Argufy_ is a program that manages arguments for CLI programs by storing them in a separate XML file so that they are readily updatable in both source code and README documentation. It also generates the script that extracts those arguments and works with _Google Closure Compiler_. [Read More](https://github.com/artdecocode/argufy#usually-integration). | ||
[1]: https://artd.eco | ||
<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/-1.svg?sanitize=true"></a></p> | ||
## Copyright | ||
(c) [Art Deco][1] 2019 | ||
[1]: https://artd.eco | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/-1.svg?sanitize=true"></a></p> |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13394
6
7
209
120
1