Galerie und tage

This commit is contained in:
2021-11-23 17:56:26 +01:00
parent ff35366279
commit 5f873bee89
4693 changed files with 149659 additions and 301447 deletions

6
node_modules/coa/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,6 @@
.idea
*.iml
node_modules/
!node_modules/coa*.js
lib-cov/
html-report/

View File

@@ -0,0 +1 @@
{}

File diff suppressed because one or more lines are too long

9
node_modules/coa/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,9 @@
language: node_js
node_js:
- "0.10"
- "0.11"
matrix:
allow_failures:
- node_js: 0.11

34
node_modules/coa/GNUmakefile generated vendored Normal file
View File

@@ -0,0 +1,34 @@
BIN = ./node_modules/.bin
.PHONY: all
all: lib
lib: $(foreach s,$(wildcard src/*.coffee),$(patsubst src/%.coffee,lib/%.js,$s))
lib-cov: clean-coverage lib
$(BIN)/istanbul instrument --output lib-cov --no-compact --variable global.__coverage__ lib
lib/%.js: src/%.coffee
$(BIN)/coffee -cb -o $(@D) $<
.PHONY: test
test: lib
$(BIN)/mocha
.PHONY: coverage
coverage: lib-cov
COVER=1 $(BIN)/mocha --reporter mocha-istanbul
@echo
@echo Open html-report/index.html file in your browser
.PHONY: watch
watch:
$(BIN)/coffee --watch --bare --output lib src/*.coffee
.PHONY: clean
clean: clean-coverage
.PHONY: clean-coverage
clean-coverage:
-rm -rf lib-cov
-rm -rf html-report

21
node_modules/coa/LICENSE generated vendored
View File

@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015-present Sergey Berezhnoy <veged@ya.ru>
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.

20
node_modules/coa/README.md generated vendored
View File

@@ -1,23 +1,5 @@
# Command-Option-Argument
Yet another parser for command line options.
[![NPM Status][npm-img]][npm]
[![Travis Status][test-img]][travis]
[![AppVeyor Status][appveyor-img]][appveyor]
[![Coverage Status][coverage-img]][coveralls]
[![Dependency Status][dependency-img]][david]
[npm]: https://www.npmjs.org/package/coa
[npm-img]: https://img.shields.io/npm/v/coa.svg
[travis]: https://travis-ci.org/veged/coa
[test-img]: https://img.shields.io/travis/veged/coa.svg
[appveyor]: https://ci.appveyor.com/project/zxqfox/coa
[appveyor-img]: https://ci.appveyor.com/api/projects/status/github/veged/coa?svg=true
[coveralls]: https://coveralls.io/r/veged/coa
[coverage-img]: https://img.shields.io/coveralls/veged/coa.svg
[david]: https://david-dm.org/veged/coa
[dependency-img]: http://img.shields.io/david/veged/coa.svg
[![build status](https://secure.travis-ci.org/veged/coa.png)](http://travis-ci.org/veged/coa)
## What is it?

74
node_modules/coa/coa.d.ts generated vendored
View File

@@ -1,74 +0,0 @@
/// <reference types="q"/>
export const Arg: undefined;
export const Opt: undefined;
export function Cmd(cmd?: classes.Cmd): classes.Cmd;
export namespace classes {
class Arg {
constructor(cmd: Cmd);
name(name: string): Arg;
title(title: string): Arg;
arr(): Arg;
req(): Arg;
val(validation: (this: Arg, value: any) => boolean): Arg;
def(def: any): Arg;
output(): Arg;
comp(fn: (opts: any) => any): Arg;
end(): Cmd;
apply(...args: any[]): Arg;
input(): Arg;
reject(...args: any[]): Arg;
}
class Cmd {
constructor(cmd?: Cmd);
static create(cmd?: Cmd): Cmd;
api(): any;
name(name: string): Cmd;
title(title: string): Cmd;
cmd(cmd?: Cmd): Cmd;
opt(): Opt;
arg(): Arg;
act(act: (opts: any, args: any[], res: any) => any, force?: boolean): Cmd;
apply(fn: Function, args?: any[]): Cmd;
comp(fs: (opts: any) => any): Cmd;
helpful(): Cmd;
completable(): Cmd;
usage(): string;
run(argv: string[]): Cmd;
invoke(cmds?: string|string[], opts?: any, args?: any): Q.Promise<any>;
reject(reason: any): Q.Promise<any>;
end(): Cmd;
do(argv: string[]): any;
extendable(pattern?: string): Cmd;
}
class Opt {
constructor(cmd?: Cmd);
name(name: string): Opt;
title(title: string): Opt;
short(short: string): Opt;
long(long: string): Opt;
flag(): Opt;
arr(): Opt;
req(): Opt;
only(): Opt;
val(validation: (this: Opt, value: any) => boolean): Opt;
def(def: any): Opt;
input(): Opt;
output(): Opt;
act(act: (opts: any, args: any[], res: any) => any): Opt;
comp(fn: (opts: any) => any): Opt;
end(): Cmd;
apply(...args: any[]): void;
reject(...args: any[]): void;
}
}
export namespace shell {
function escape(w: string): string;
function unescape(w: string): string;
}

212
node_modules/coa/coverage/base.css generated vendored Normal file
View File

@@ -0,0 +1,212 @@
body, html {
margin:0; padding: 0;
height: 100%;
}
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 14px;
color:#333;
}
.small { font-size: 12px; }
*, *:after, *:before {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
h1 { font-size: 20px; margin: 0;}
h2 { font-size: 14px; }
pre {
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0;
padding: 0;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
a { color:#0074D9; text-decoration:none; }
a:hover { text-decoration:underline; }
.strong { font-weight: bold; }
.space-top1 { padding: 10px 0 0 0; }
.pad2y { padding: 20px 0; }
.pad1y { padding: 10px 0; }
.pad2x { padding: 0 20px; }
.pad2 { padding: 20px; }
.pad1 { padding: 10px; }
.space-left2 { padding-left:55px; }
.space-right2 { padding-right:20px; }
.center { text-align:center; }
.clearfix { display:block; }
.clearfix:after {
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
.fl { float: left; }
@media only screen and (max-width:640px) {
.col3 { width:100%; max-width:100%; }
.hide-mobile { display:none!important; }
}
.quiet {
color: #7f7f7f;
color: rgba(0,0,0,0.5);
}
.quiet a { opacity: 0.7; }
.fraction {
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 10px;
color: #555;
background: #E8E8E8;
padding: 4px 5px;
border-radius: 3px;
vertical-align: middle;
}
div.path a:link, div.path a:visited { color: #333; }
table.coverage {
border-collapse: collapse;
margin: 10px 0 0 0;
padding: 0;
}
table.coverage td {
margin: 0;
padding: 0;
vertical-align: top;
}
table.coverage td.line-count {
text-align: right;
padding: 0 5px 0 20px;
}
table.coverage td.line-coverage {
text-align: right;
padding-right: 10px;
min-width:20px;
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 100%;
}
.missing-if-branch {
display: inline-block;
margin-right: 5px;
border-radius: 3px;
position: relative;
padding: 0 4px;
background: #333;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.coverage-summary {
border-collapse: collapse;
width: 100%;
}
.coverage-summary tr { border-bottom: 1px solid #bbb; }
.keyline-all { border: 1px solid #ddd; }
.coverage-summary td, .coverage-summary th { padding: 10px; }
.coverage-summary tbody { border: 1px solid #bbb; }
.coverage-summary td { border-right: 1px solid #bbb; }
.coverage-summary td:last-child { border-right: none; }
.coverage-summary th {
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.coverage-summary th.file { border-right: none !important; }
.coverage-summary th.pct { }
.coverage-summary th.pic,
.coverage-summary th.abs,
.coverage-summary td.pct,
.coverage-summary td.abs { text-align: right; }
.coverage-summary td.file { white-space: nowrap; }
.coverage-summary td.pic { min-width: 120px !important; }
.coverage-summary tfoot td { }
.coverage-summary .sorter {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
}
.coverage-summary .sorted .sorter {
background-position: 0 -20px;
}
.coverage-summary .sorted-desc .sorter {
background-position: 0 -10px;
}
.status-line { height: 10px; }
/* dark red */
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
.low .chart { border:1px solid #C21F39 }
/* medium red */
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
/* light red */
.low, .cline-no { background:#FCE1E5 }
/* light green */
.high, .cline-yes { background:rgb(230,245,208) }
/* medium green */
.cstat-yes { background:rgb(161,215,106) }
/* dark green */
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
.high .chart { border:1px solid rgb(77,146,33) }
.medium .chart { border:1px solid #666; }
.medium .cover-fill { background: #666; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
span.cline-neutral { background: #eaeaea; }
.medium { background: #eaeaea; }
.cover-fill, .cover-empty {
display:inline-block;
height: 12px;
}
.chart {
line-height: 0;
}
.cover-empty {
background: white;
}
.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -48px;
}
.footer, .push {
height: 48px;
}

93
node_modules/coa/coverage/coa/index.html generated vendored Normal file
View File

@@ -0,0 +1,93 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">All files</a> coa
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/1</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

68
node_modules/coa/coverage/coa/index.js.html generated vendored Normal file
View File

@@ -0,0 +1,68 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/index.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">All files</a> / <a href="index.html">coa</a> index.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/1</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">module.exports = require('./lib');
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

239
node_modules/coa/coverage/coa/lib/arg.js.html generated vendored Normal file
View File

@@ -0,0 +1,239 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/arg.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> arg.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>16/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">87.5% </span>
<span class="quiet">Branches</span>
<span class='fraction'>7/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>16/16</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">31x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">31x</span>
<span class="cline-any cline-yes">31x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">31x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
&nbsp;
const
CoaParam = require('./coaparam'),
Color = require('./color');
&nbsp;
/**
* Argument
*
* Unnamed entity. From command line arguments passed as list of unnamed values.
*
* @class Arg
* @extends CoaParam
*/
module.exports = class Arg extends CoaParam {
/**
* @constructs
* @param {COA.Cmd} cmd - parent command
*/
constructor(cmd) {
super(cmd);
&nbsp;
this._cmd._args.push(this);
}
&nbsp;
_saveVal(args, val) {
this._val &amp;&amp; (<span class="branch-1 cbranch-no" title="branch not covered" >val = this._val(val))</span>;
&nbsp;
const name = this._name;
this._arr
? (args[name] || (args[name] = [])).push(val)
: (args[name] = val);
&nbsp;
return val;
}
&nbsp;
_parse(arg, args) {
return this._saveVal(args, arg);
}
&nbsp;
_checkParsed(opts, args) {
return !args.hasOwnProperty(this._name);
}
&nbsp;
_usage() {
const res = [];
&nbsp;
res.push(Color('lpurple', this._name.toUpperCase()), ' : ', this._title);
&nbsp;
this._req &amp;&amp; res.push(' ', Color('lred', '(required)'));
&nbsp;
return res.join('');
}
&nbsp;
_requiredText() {
return `Missing required argument:\n ${this._usage()}`;
}
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

1556
node_modules/coa/coverage/coa/lib/cmd.js.html generated vendored Normal file

File diff suppressed because it is too large Load Diff

365
node_modules/coa/coverage/coa/lib/coaobject.js.html generated vendored Normal file
View File

@@ -0,0 +1,365 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/coaobject.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> coaobject.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">75% </span>
<span class="quiet">Statements</span>
<span class='fraction'>12/16</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">50% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">71.43% </span>
<span class="quiet">Functions</span>
<span class='fraction'>5/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">75% </span>
<span class="quiet">Lines</span>
<span class='fraction'>12/16</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">58x</span>
<span class="cline-any cline-yes">58x</span>
<span class="cline-any cline-yes">58x</span>
<span class="cline-any cline-yes">58x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">44x</span>
<span class="cline-any cline-yes">44x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">38x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
&nbsp;
const Q = require('q');
&nbsp;
/**
* COA Object
*
* Base class for all COA-related objects
*
* --------|-----|-----|-----
* | Cmd | Opt | Arg
* --------|-----|-----|-----
* name | ✓ | ✓ | ✓
* title | ✓ | ✓ | ✓
* comp | ✓ | ✓ | ✓
* reject | ✓ | ✓ | ✓
* end | ✓ | ✓ | ✓
* apply | ✓ | ✓ | ✓
*
* @class CoaObject
*/
module.exports = class CoaObject {
constructor(cmd) {
this._cmd = cmd;
this._name = null;
this._title = null;
this._comp = null;
}
&nbsp;
/**
* Set a canonical identifier to be used anywhere in the API.
*
* @param {String} name - command, option or argument name
* @returns {COA.CoaObject} - this instance (for chainability)
*/
name(name) {
this._name = name;
return this;
}
&nbsp;
/**
* Set a long description to be used anywhere in text messages.
* @param {String} title - human readable entity title
* @returns {COA.CoaObject} - this instance (for chainability)
*/
<span class="fstat-no" title="function not covered" > ti</span>tle(title) {
<span class="cstat-no" title="statement not covered" > this._title = title;</span>
<span class="cstat-no" title="statement not covered" > return this;</span>
}
&nbsp;
/**
* Set custom additional completion for current object.
*
* @param {Function} comp - completion generation function,
* invoked in the context of object instance.
* Accepts parameters:
* - {Object} opts - completion options
* It can return promise or any other value threated as a result.
* @returns {COA.CoaObject} - this instance (for chainability)
*/
<span class="fstat-no" title="function not covered" > co</span>mp(comp) {
<span class="cstat-no" title="statement not covered" > this._comp = comp;</span>
<span class="cstat-no" title="statement not covered" > return this;</span>
}
&nbsp;
/**
* Apply function with arguments in a context of object instance.
*
* @param {Function} fn - body
* @param {Array.&lt;*&gt;} args... - arguments
* @returns {COA.CoaObject} - this instance (for chainability)
*/
apply(fn) {
arguments.length &gt; 1?
<span class="branch-0 cbranch-no" title="branch not covered" > fn.apply(this, [].slice.call(arguments, 1))</span>
: fn.call(this);
&nbsp;
return this;
}
&nbsp;
/**
* Return reject of actions results promise with error code.
* Use in .act() for return with error.
* @param {Object} reason - reject reason
* You can customize toString() method and exitCode property
* of reason object.
* @returns {Q.promise} rejected promise
*/
reject(reason) {
return Q.reject(reason);
}
&nbsp;
/**
* Finish chain for current subcommand and return parent command instance.
* @returns {COA.Cmd} parent command
*/
end() {
return this._cmd;
}
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

440
node_modules/coa/coverage/coa/lib/coaparam.js.html generated vendored Normal file
View File

@@ -0,0 +1,440 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/coaparam.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> coaparam.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">51.61% </span>
<span class="quiet">Statements</span>
<span class='fraction'>16/31</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">55.56% </span>
<span class="quiet">Functions</span>
<span class='fraction'>5/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">51.61% </span>
<span class="quiet">Lines</span>
<span class='fraction'>16/31</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
&nbsp;
const fs = require('fs');
&nbsp;
const CoaObject = require('./coaobject');
&nbsp;
/**
* COA Parameter
*
* Base class for options and arguments
*
* --------|-----|-----|-----
* | Cmd | Opt | Arg
* --------|-----|-----|-----
* arr | | ✓ | ✓
* req | | ✓ | ✓
* val | | ✓ | ✓
* def | | ✓ | ✓
* input | | ✓ | ✓
* output | | ✓ | ✓
*
* @class CoaParam
* @extends CoaObject
*/
module.exports = class CoaParam extends CoaObject {
constructor(cmd) {
super(cmd);
&nbsp;
this._arr = false;
this._req = false;
this._val = undefined;
this._def = undefined;
}
&nbsp;
/**
* Makes a param accepts multiple values.
* Otherwise, the value will be used by the latter passed.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
arr() {
this._arr = true;
return this;
}
&nbsp;
/**
* Makes a param required.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
req() {
this._req = true;
return this;
}
&nbsp;
/**
* Set a validation (or value) function for param.
* Value from command line passes through before becoming available from API.
* Using for validation and convertion simple types to any values.
*
* @param {Function} val - validating function,
* invoked in the context of option instance
* and has one parameter with value from command line.
* @returns {COA.CoaParam} - this instance (for chainability)
*/
val(val) {
this._val = val;
return this;
}
&nbsp;
/**
* Set a default value for param.
* Default value passed through validation function as ordinary value.
*
* @param {*} def - default value of function generator
* @returns {COA.CoaParam} - this instance (for chainability)
*/
def(def) {
this._def = def;
return this;
}
&nbsp;
/**
* Make option value inputting stream.
* It's add useful validation and shortcut for STDIN.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
<span class="fstat-no" title="function not covered" > in</span>put() {
<span class="cstat-no" title="statement not covered" > process.stdin.pause();</span>
<span class="cstat-no" title="statement not covered" > return this</span>
.def(process.stdin)
.val(<span class="fstat-no" title="function not covered" >fu</span>nction(v) {
<span class="cstat-no" title="statement not covered" > if(typeof v !== 'string')</span>
<span class="cstat-no" title="statement not covered" > return v;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if(v === '-')</span>
<span class="cstat-no" title="statement not covered" > return process.stdin;</span>
&nbsp;
const s = <span class="cstat-no" title="statement not covered" >fs.createReadStream(v, { encoding : 'utf8' });</span>
<span class="cstat-no" title="statement not covered" > s.pause();</span>
<span class="cstat-no" title="statement not covered" > return s;</span>
});
}
&nbsp;
/**
* Make option value outputing stream.
* It's add useful validation and shortcut for STDOUT.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
<span class="fstat-no" title="function not covered" > ou</span>tput() {
<span class="cstat-no" title="statement not covered" > return this</span>
.def(process.stdout)
.val(<span class="fstat-no" title="function not covered" >fu</span>nction(v) {
<span class="cstat-no" title="statement not covered" > if(typeof v !== 'string')</span>
<span class="cstat-no" title="statement not covered" > return v;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > if(v === '-')</span>
<span class="cstat-no" title="statement not covered" > return process.stdout;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return fs.createWriteStream(v, { encoding : 'utf8' });</span>
});
}
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

131
node_modules/coa/coverage/coa/lib/color.js.html generated vendored Normal file
View File

@@ -0,0 +1,131 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/color.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> color.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>2/2</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
&nbsp;
const colors = {
black : '30',
dgray : '1;30',
red : '31',
lred : '1;31',
green : '32',
lgreen : '1;32',
brown : '33',
yellow : '1;33',
blue : '34',
lblue : '1;34',
purple : '35',
lpurple : '1;35',
cyan : '36',
lcyan : '1;36',
lgray : '37',
white : '1;37'
};
&nbsp;
module.exports = (c, str) =&gt; `\x1B[${colors[c]}m${str}\x1B[m`;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

593
node_modules/coa/coverage/coa/lib/completion.js.html generated vendored Normal file
View File

@@ -0,0 +1,593 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/completion.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> completion.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">11.27% </span>
<span class="quiet">Statements</span>
<span class='fraction'>8/71</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/32</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">12.5% </span>
<span class="quiet">Lines</span>
<span class='fraction'>8/64</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
&nbsp;
const constants = require('constants');
const fs = require('fs');
const path = require('path');
&nbsp;
const Q = require('q');
&nbsp;
const shell = require('./shell');
const escape = shell.escape;
const unescape = shell.unescape;
&nbsp;
/**
* Most of the code adopted from the npm package shell completion code.
* See https://github.com/isaacs/npm/blob/master/lib/completion.js
*
* @returns {COA.CoaObject}
*/
module.exports = function <span class="fstat-no" title="function not covered" >completion(</span>) {
<span class="cstat-no" title="statement not covered" > return this</span>
.title('Shell completion')
.helpful()
.arg()
.name('raw')
.title('Completion words')
.arr()
.end()
.act(<span class="fstat-no" title="function not covered" >(o</span>pts, args) =&gt; {
<span class="cstat-no" title="statement not covered" > if(process.platform === 'win32') {</span>
const e = <span class="cstat-no" title="statement not covered" >new Error('shell completion not supported on windows');</span>
<span class="cstat-no" title="statement not covered" > e.code = 'ENOTSUP';</span>
<span class="cstat-no" title="statement not covered" > e.errno = constants.ENOTSUP;</span>
<span class="cstat-no" title="statement not covered" > return this.reject(e);</span>
}
&nbsp;
// if the COMP_* isn't in the env, then just dump the script
<span class="cstat-no" title="statement not covered" > if((process.env.COMP_CWORD == null)</span>
|| (process.env.COMP_LINE == null)
|| (process.env.COMP_POINT == null)) {
<span class="cstat-no" title="statement not covered" > return dumpScript(this._cmd._name);</span>
}
&nbsp;
<span class="cstat-no" title="statement not covered" > console.error('COMP_LINE: %s', process.env.COMP_LINE);</span>
<span class="cstat-no" title="statement not covered" > console.error('COMP_CWORD: %s', process.env.COMP_CWORD);</span>
<span class="cstat-no" title="statement not covered" > console.error('COMP_POINT: %s', process.env.COMP_POINT);</span>
<span class="cstat-no" title="statement not covered" > console.error('args: %j', args.raw);</span>
&nbsp;
// completion opts
<span class="cstat-no" title="statement not covered" > opts = getOpts(args.raw);</span>
&nbsp;
// cmd
const parsed = <span class="cstat-no" title="statement not covered" >this._cmd._parseCmd(opts.partialWords);</span>
<span class="cstat-no" title="statement not covered" > return Q.when(complete(parsed.cmd, parsed.opts), <span class="fstat-no" title="function not covered" >(c</span>ompls) =&gt; {</span>
<span class="cstat-no" title="statement not covered" > console.error('filtered: %j', compls);</span>
<span class="cstat-no" title="statement not covered" > return console.log(compls.map(escape).join('\n'));</span>
});
});
};
&nbsp;
function <span class="fstat-no" title="function not covered" >dumpScript(</span>name) {
const defer = <span class="cstat-no" title="statement not covered" >Q.defer();</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > fs.readFile(path.resolve(__dirname, 'completion.sh'), 'utf8', <span class="fstat-no" title="function not covered" >fu</span>nction(err, d) {</span>
<span class="cstat-no" title="statement not covered" > if(err) <span class="cstat-no" title="statement not covered" >return defer.reject(err);</span></span>
<span class="cstat-no" title="statement not covered" > d = d.replace(/{{cmd}}/g, path.basename(name)).replace(/^\#\!.*?\n/, '');</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > process.stdout.on('error', onError);</span>
<span class="cstat-no" title="statement not covered" > process.stdout.write(d, <span class="fstat-no" title="function not covered" >()</span> =&gt; <span class="cstat-no" title="statement not covered" >defer.resolve())</span>;</span>
});
&nbsp;
<span class="cstat-no" title="statement not covered" > return defer.promise;</span>
&nbsp;
function <span class="fstat-no" title="function not covered" >onError(</span>err) {
// Darwin is a real dick sometimes.
//
// This is necessary because the "source" or "." program in
// bash on OS X closes its file argument before reading
// from it, meaning that you get exactly 1 write, which will
// work most of the time, and will always raise an EPIPE.
//
// Really, one should not be tossing away EPIPE errors, or any
// errors, so casually. But, without this, `. &lt;(cmd completion)`
// can never ever work on OS X.
<span class="cstat-no" title="statement not covered" > if(err.errno !== constants.EPIPE) <span class="cstat-no" title="statement not covered" >return defer.reject(err);</span></span>
<span class="cstat-no" title="statement not covered" > process.stdout.removeListener('error', onError);</span>
<span class="cstat-no" title="statement not covered" > return defer.resolve();</span>
}
}
&nbsp;
function <span class="fstat-no" title="function not covered" >getOpts(</span>argv) {
// get the partial line and partial word, if the point isn't at the end
// ie, tabbing at: cmd foo b|ar
const line = <span class="cstat-no" title="statement not covered" >process.env.COMP_LINE;</span>
const w = <span class="cstat-no" title="statement not covered" >+process.env.COMP_CWORD;</span>
const point = <span class="cstat-no" title="statement not covered" >+process.env.COMP_POINT;</span>
const words = <span class="cstat-no" title="statement not covered" >argv.map(unescape);</span>
const word = <span class="cstat-no" title="statement not covered" >words[w];</span>
const partialLine = <span class="cstat-no" title="statement not covered" >line.substr(0, point);</span>
const partialWords = <span class="cstat-no" title="statement not covered" >words.slice(0, w);</span>
&nbsp;
// figure out where in that last word the point is
let partialWord = <span class="cstat-no" title="statement not covered" >argv[w] || '';</span>
let i = <span class="cstat-no" title="statement not covered" >partialWord.length;</span>
<span class="cstat-no" title="statement not covered" > while(partialWord.substr(0, i) !== partialLine.substr(-1 * i) &amp;&amp; i &gt; 0) <span class="cstat-no" title="statement not covered" >i--;</span></span>
&nbsp;
<span class="cstat-no" title="statement not covered" > partialWord = unescape(partialWord.substr(0, i));</span>
<span class="cstat-no" title="statement not covered" > partialWord &amp;&amp; partialWords.push(partialWord);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" > return {</span>
line,
w,
point,
words,
word,
partialLine,
partialWords,
partialWord
};
}
&nbsp;
function <span class="fstat-no" title="function not covered" >complete(</span>cmd, opts) {
let optWord, optPrefix,
compls = <span class="cstat-no" title="statement not covered" >[];</span>
&nbsp;
// Complete on cmds
<span class="cstat-no" title="statement not covered" > if(opts.partialWord.indexOf('-'))</span>
<span class="cstat-no" title="statement not covered" > compls = Object.keys(cmd._cmdsByName);</span>
// Complete on required opts without '-' in last partial word
// (if required not already specified)
//
// Commented out because of uselessness:
// -b, --block suggest results in '-' on cmd line;
// next completion suggest all options, because of '-'
//.concat Object.keys(cmd._optsByKey).filter (v) -&gt; cmd._optsByKey[v]._req
else {
// complete on opt values: --opt=| case
const m = <span class="cstat-no" title="statement not covered" >opts.partialWord.match(/^(--\w[\w-_]*)=(.*)$/);</span>
<span class="cstat-no" title="statement not covered" > if(m) {</span>
<span class="cstat-no" title="statement not covered" > optWord = m[1];</span>
<span class="cstat-no" title="statement not covered" > optPrefix = optWord + '=';</span>
} else
// complete on opts
// don't complete on opts in case of --opt=val completion
// TODO: don't complete on opts in case of unknown arg after commands
// TODO: complete only on opts with arr() or not already used
// TODO: complete only on full opts?
<span class="cstat-no" title="statement not covered" > compls = Object.keys(cmd._optsByKey);</span>
}
&nbsp;
// complete on opt values: next arg case
<span class="cstat-no" title="statement not covered" > opts.partialWords[opts.w - 1].indexOf('-') || (optWord = opts.partialWords[opts.w - 1]);</span>
&nbsp;
// complete on opt values: completion
let opt;
<span class="cstat-no" title="statement not covered" > optWord</span>
&amp;&amp; (opt = cmd._optsByKey[optWord])
&amp;&amp; !opt._flag
&amp;&amp; opt._comp
&amp;&amp; (compls = Q.join(compls,
Q.when(opt._comp(opts),
<span class="fstat-no" title="function not covered" > (c</span>, o) =&gt; <span class="cstat-no" title="statement not covered" >c.concat(o.map(<span class="fstat-no" title="function not covered" >v </span>=&gt; <span class="cstat-no" title="statement not covered" >(optPrefix || '') + v)</span>))</span>));
&nbsp;
// TODO: complete on args values (context aware, custom completion?)
&nbsp;
// custom completion on cmds
<span class="cstat-no" title="statement not covered" > cmd._comp &amp;&amp; (compls = Q.join(compls, Q.when(cmd._comp(opts)), <span class="fstat-no" title="function not covered" >(c</span>, o) =&gt; <span class="cstat-no" title="statement not covered" >c.concat(o))</span>);</span>
&nbsp;
// TODO: context aware custom completion on cmds, opts and args
// (can depend on already entered values, especially options)
&nbsp;
<span class="cstat-no" title="statement not covered" > return Q.when(compls, <span class="fstat-no" title="function not covered" >co</span>mplitions =&gt; {</span>
<span class="cstat-no" title="statement not covered" > console.error('partialWord: %s', opts.partialWord);</span>
<span class="cstat-no" title="statement not covered" > console.error('compls: %j', complitions);</span>
<span class="cstat-no" title="statement not covered" > return compls.filter(<span class="fstat-no" title="function not covered" >(c</span>) =&gt; <span class="cstat-no" title="statement not covered" >c.indexOf(opts.partialWord) === 0)</span>;</span>
});
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

197
node_modules/coa/coverage/coa/lib/index.html generated vendored Normal file
View File

@@ -0,0 +1,197 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> coa/lib
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">68.17% </span>
<span class="quiet">Statements</span>
<span class='fraction'>257/377</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">59.05% </span>
<span class="quiet">Branches</span>
<span class='fraction'>124/210</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">65.35% </span>
<span class="quiet">Functions</span>
<span class='fraction'>66/101</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">69.8% </span>
<span class="quiet">Lines</span>
<span class='fraction'>245/351</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="arg.js"><a href="arg.js.html">arg.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="16" class="abs high">16/16</td>
<td data-value="87.5" class="pct high">87.5%</td>
<td data-value="8" class="abs high">7/8</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="16" class="abs high">16/16</td>
</tr>
<tr>
<td class="file high" data-value="cmd.js"><a href="cmd.js.html">cmd.js</a></td>
<td data-value="81.22" class="pic high"><div class="chart"><div class="cover-fill" style="width: 81%;"></div><div class="cover-empty" style="width:19%;"></div></div></td>
<td data-value="81.22" class="pct high">81.22%</td>
<td data-value="181" class="abs high">147/181</td>
<td data-value="71.64" class="pct medium">71.64%</td>
<td data-value="134" class="abs medium">96/134</td>
<td data-value="68.75" class="pct medium">68.75%</td>
<td data-value="48" class="abs medium">33/48</td>
<td data-value="82.53" class="pct high">82.53%</td>
<td data-value="166" class="abs high">137/166</td>
</tr>
<tr>
<td class="file medium" data-value="coaobject.js"><a href="coaobject.js.html">coaobject.js</a></td>
<td data-value="75" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="16" class="abs medium">12/16</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="2" class="abs medium">1/2</td>
<td data-value="71.43" class="pct medium">71.43%</td>
<td data-value="7" class="abs medium">5/7</td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="16" class="abs medium">12/16</td>
</tr>
<tr>
<td class="file medium" data-value="coaparam.js"><a href="coaparam.js.html">coaparam.js</a></td>
<td data-value="51.61" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 51%;"></div><div class="cover-empty" style="width:49%;"></div></div></td>
<td data-value="51.61" class="pct medium">51.61%</td>
<td data-value="31" class="abs medium">16/31</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="8" class="abs low">0/8</td>
<td data-value="55.56" class="pct medium">55.56%</td>
<td data-value="9" class="abs medium">5/9</td>
<td data-value="51.61" class="pct medium">51.61%</td>
<td data-value="31" class="abs medium">16/31</td>
</tr>
<tr>
<td class="file high" data-value="color.js"><a href="color.js.html">color.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
</tr>
<tr>
<td class="file low" data-value="completion.js"><a href="completion.js.html">completion.js</a></td>
<td data-value="11.27" class="pic low"><div class="chart"><div class="cover-fill" style="width: 11%;"></div><div class="cover-empty" style="width:89%;"></div></div></td>
<td data-value="11.27" class="pct low">11.27%</td>
<td data-value="71" class="abs low">8/71</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="32" class="abs low">0/32</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="14" class="abs low">0/14</td>
<td data-value="12.5" class="pct low">12.5%</td>
<td data-value="64" class="abs low">8/64</td>
</tr>
<tr>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">5/5</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">5/5</td>
</tr>
<tr>
<td class="file high" data-value="opt.js"><a href="opt.js.html">opt.js</a></td>
<td data-value="91.84" class="pic high"><div class="chart"><div class="cover-fill" style="width: 91%;"></div><div class="cover-empty" style="width:9%;"></div></div></td>
<td data-value="91.84" class="pct high">91.84%</td>
<td data-value="49" class="abs high">45/49</td>
<td data-value="72.73" class="pct medium">72.73%</td>
<td data-value="22" class="abs medium">16/22</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">14/14</td>
<td data-value="95.65" class="pct high">95.65%</td>
<td data-value="46" class="abs high">44/46</td>
</tr>
<tr>
<td class="file high" data-value="shell.js"><a href="shell.js.html">shell.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">5/5</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">5/5</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

107
node_modules/coa/coverage/coa/lib/index.js.html generated vendored Normal file
View File

@@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/index.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> index.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>5/5</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>5/5</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">const
Cmd = require('./cmd'),
Opt = require('./opt'),
Arg = require('./arg'),
shell = require('./shell');
&nbsp;
module.exports = {
Cmd : Cmd.create,
Opt : Opt.create,
Arg : Arg.create,
classes : { Cmd, Opt, Arg },
shell,
require
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

524
node_modules/coa/coverage/coa/lib/opt.js.html generated vendored Normal file
View File

@@ -0,0 +1,524 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/opt.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> opt.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">91.84% </span>
<span class="quiet">Statements</span>
<span class='fraction'>45/49</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">72.73% </span>
<span class="quiet">Branches</span>
<span class='fraction'>16/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>14/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">95.65% </span>
<span class="quiet">Lines</span>
<span class='fraction'>44/46</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">20x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">20x</span>
<span class="cline-any cline-yes">20x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">20x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
&nbsp;
const
Q = require('q'),
&nbsp;
CoaParam = require('./coaparam'),
Color = require('./color');
&nbsp;
/**
* Option
*
* Named entity. Options may have short and long keys for use from command line.
*
* @namespace
* @class Opt
* @extends CoaParam
*/
module.exports = class Opt extends CoaParam {
/**
* @constructs
* @param {COA.Cmd} cmd - parent command
*/
constructor(cmd) {
super(cmd);
&nbsp;
this._short = null;
this._long = null;
this._flag = false;
this._only = false;
this._cmd._opts.push(this);
}
&nbsp;
/**
* Set a short key for option to be used with one hyphen from command line.
*
* @param {String} short - short name
* @returns {COA.Opt} - this instance (for chainability)
*/
short(short) {
this._short = short;
this._cmd._optsByKey[`-${short}`] = this;
return this;
}
&nbsp;
/**
* Set a short key for option to be used with double hyphens from command line.
*
* @param {String} long - long name
* @returns {COA.Opt} - this instance (for chainability)
*/
long(long) {
this._long = long;
this._cmd._optsByKey[`--${long}`] = this;
return this;
}
&nbsp;
/**
* Make an option boolean, i.e. option without value.
*
* @returns {COA.Opt} - this instance (for chainability)
*/
flag() {
this._flag = true;
return this;
}
&nbsp;
/**
* Makes an option to act as a command,
* i.e. program will exit just after option action.
*
* @returns {COA.Opt} - this instance (for chainability)
*/
only() {
this._only = true;
return this;
}
&nbsp;
/**
* Add action for current option command.
* This action is performed if the current option
* is present in parsed options (with any value).
*
* @param {Function} act - action function,
* invoked in the context of command instance
* and has the parameters:
* - {Object} opts - parsed options
* - {Array} args - parsed arguments
* - {Object} res - actions result accumulator
* It can return rejected promise by Cmd.reject (in case of error)
* or any other value treated as result.
* @returns {COA.Opt} - this instance (for chainability)
*/
act(act) {
this._cmd.act((opts) =&gt; {
<span class="missing-if-branch" title="if path not taken" >I</span>if(!opts.hasOwnProperty(this._name)) <span class="cstat-no" title="statement not covered" >return;</span>
&nbsp;
const res = act.apply(this._cmd, arguments);
<span class="missing-if-branch" title="if path not taken" >I</span>if(!this._only) <span class="cstat-no" title="statement not covered" >return res;</span>
&nbsp;
return Q.when(res, (out) =&gt; this._cmd.reject({
toString : () =&gt; out.toString(),
exitCode : 0
}));
});
&nbsp;
return this;
}
&nbsp;
_saveVal(opts, val) {
this._val &amp;&amp; (val = this._val(val));
&nbsp;
const name = this._name;
this._arr
? (opts[name] || (opts[name] = [])).push(val)
: (opts[name] = val);
&nbsp;
return val;
}
&nbsp;
_parse(argv, opts) {
return this._saveVal(opts, this._flag ? true : argv.shift());
}
&nbsp;
_checkParsed(opts) {
return !opts.hasOwnProperty(this._name);
}
&nbsp;
_usage() {
const res = [],
nameStr = this._name.toUpperCase();
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if(this._short) {
res.push('-', Color('lgreen', this._short));
this._flag || res.push(' ' + nameStr);
res.push(', ');
}
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if(this._long) {
<span class="cstat-no" title="statement not covered" > res.push('--', Color('green', this._long));</span>
<span class="cstat-no" title="statement not covered" > this._flag || res.push('=' + nameStr);</span>
}
&nbsp;
res.push(' : ', this._title);
&nbsp;
this._req &amp;&amp; res.push(' ', Color('lred', '(required)'));
&nbsp;
return res.join('');
}
&nbsp;
_requiredText() {
return `Missing required option:\n ${this._usage()}`;
}
};
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

107
node_modules/coa/coverage/coa/lib/shell.js.html generated vendored Normal file
View File

@@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for coa/lib/shell.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">coa/lib</a> shell.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>5/5</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>5/5</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">module.exports = { escape, unescape };
&nbsp;
function unescape(w) {
w = w.charAt(0) === '"'
? w.replace(/^"|([^\\])"$/g, '$1')
: w.replace(/\\ /g, ' ');
&nbsp;
return w.replace(/\\("|'|\$|`|\\)/g, '$1');
}
&nbsp;
function escape(w) {
w = w.replace(/(["'$`\\])/g,'\\$1');
return w.match(/\s+/) ? `"${w}"` : w;
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

106
node_modules/coa/coverage/index.html generated vendored Normal file
View File

@@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
All files
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">68.25% </span>
<span class="quiet">Statements</span>
<span class='fraction'>258/378</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">59.05% </span>
<span class="quiet">Branches</span>
<span class='fraction'>124/210</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">65.35% </span>
<span class="quiet">Functions</span>
<span class='fraction'>66/101</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">69.89% </span>
<span class="quiet">Lines</span>
<span class='fraction'>246/352</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="coa"><a href="coa/index.html">coa</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
</tr>
<tr>
<td class="file medium" data-value="coa/lib"><a href="coa/lib/index.html">coa/lib</a></td>
<td data-value="68.17" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 68%;"></div><div class="cover-empty" style="width:32%;"></div></div></td>
<td data-value="68.17" class="pct medium">68.17%</td>
<td data-value="377" class="abs medium">257/377</td>
<td data-value="59.05" class="pct medium">59.05%</td>
<td data-value="210" class="abs medium">124/210</td>
<td data-value="65.35" class="pct medium">65.35%</td>
<td data-value="101" class="abs medium">66/101</td>
<td data-value="69.8" class="pct medium">69.8%</td>
<td data-value="351" class="abs medium">245/351</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Feb 17 2017 22:25:28 GMT+0300 (MSK)
</div>
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="sorter.js"></script>
</body>
</html>

1
node_modules/coa/coverage/prettify.css generated vendored Normal file
View File

@@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

1
node_modules/coa/coverage/prettify.js generated vendored Normal file

File diff suppressed because one or more lines are too long

BIN
node_modules/coa/coverage/sort-arrow-sprite.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

158
node_modules/coa/coverage/sorter.js generated vendored Normal file
View File

@@ -0,0 +1,158 @@
var addSorting = (function () {
"use strict";
var cols,
currentSort = {
index: 0,
desc: false
};
// returns the summary table element
function getTable() { return document.querySelector('.coverage-summary'); }
// returns the thead element of the summary table
function getTableHeader() { return getTable().querySelector('thead tr'); }
// returns the tbody element of the summary table
function getTableBody() { return getTable().querySelector('tbody'); }
// returns the th element for nth column
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
// loads all columns
function loadColumns() {
var colNodes = getTableHeader().querySelectorAll('th'),
colNode,
cols = [],
col,
i;
for (i = 0; i < colNodes.length; i += 1) {
colNode = colNodes[i];
col = {
key: colNode.getAttribute('data-col'),
sortable: !colNode.getAttribute('data-nosort'),
type: colNode.getAttribute('data-type') || 'string'
};
cols.push(col);
if (col.sortable) {
col.defaultDescSort = col.type === 'number';
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
}
}
return cols;
}
// attaches a data attribute to every tr element with an object
// of data values keyed by column name
function loadRowData(tableRow) {
var tableCols = tableRow.querySelectorAll('td'),
colNode,
col,
data = {},
i,
val;
for (i = 0; i < tableCols.length; i += 1) {
colNode = tableCols[i];
col = cols[i];
val = colNode.getAttribute('data-value');
if (col.type === 'number') {
val = Number(val);
}
data[col.key] = val;
}
return data;
}
// loads all row data
function loadData() {
var rows = getTableBody().querySelectorAll('tr'),
i;
for (i = 0; i < rows.length; i += 1) {
rows[i].data = loadRowData(rows[i]);
}
}
// sorts the table using the data for the ith column
function sortByIndex(index, desc) {
var key = cols[index].key,
sorter = function (a, b) {
a = a.data[key];
b = b.data[key];
return a < b ? -1 : a > b ? 1 : 0;
},
finalSorter = sorter,
tableBody = document.querySelector('.coverage-summary tbody'),
rowNodes = tableBody.querySelectorAll('tr'),
rows = [],
i;
if (desc) {
finalSorter = function (a, b) {
return -1 * sorter(a, b);
};
}
for (i = 0; i < rowNodes.length; i += 1) {
rows.push(rowNodes[i]);
tableBody.removeChild(rowNodes[i]);
}
rows.sort(finalSorter);
for (i = 0; i < rows.length; i += 1) {
tableBody.appendChild(rows[i]);
}
}
// removes sort indicators for current column being sorted
function removeSortIndicators() {
var col = getNthColumn(currentSort.index),
cls = col.className;
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
col.className = cls;
}
// adds sort indicators for current column being sorted
function addSortIndicators() {
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
}
// adds event listeners for all sorter widgets
function enableUI() {
var i,
el,
ithSorter = function ithSorter(i) {
var col = cols[i];
return function () {
var desc = col.defaultDescSort;
if (currentSort.index === i) {
desc = !currentSort.desc;
}
sortByIndex(i, desc);
removeSortIndicators();
currentSort.index = i;
currentSort.desc = desc;
addSortIndicators();
};
};
for (i =0 ; i < cols.length; i += 1) {
if (cols[i].sortable) {
// add the click event handler on the th so users
// dont have to click on those tiny arrows
el = getNthColumn(i).querySelector('.sorter').parentElement;
if (el.addEventListener) {
el.addEventListener('click', ithSorter(i));
} else {
el.attachEvent('onclick', ithSorter(i));
}
}
}
}
// adds sorting functionality to the UI
return function () {
if (!getTable()) {
return;
}
cols = loadColumns();
loadData(cols);
addSortIndicators();
enableUI();
};
})();
window.addEventListener('load', addSorting);

2
node_modules/coa/index.js generated vendored
View File

@@ -1 +1 @@
module.exports = require('./lib');
module.exports = require(process.env.COVER? './lib-cov' : './lib');

203
node_modules/coa/lib/arg.js generated vendored
View File

@@ -1,58 +1,175 @@
'use strict';
// Generated by CoffeeScript 1.6.3
var Arg, Cmd, Color, Opt;
const
CoaParam = require('./coaparam'),
chalk = require('chalk');
Color = require('./color').Color;
Cmd = require('./cmd').Cmd;
Opt = require('./opt').Opt;
/**
* Argument
*
* Unnamed entity. From command line arguments passed as list of unnamed values.
*
* @class Arg
* @extends CoaParam
*/
module.exports = class Arg extends CoaParam {
/**
* @constructs
* @param {COA.Cmd} cmd - parent command
*/
constructor(cmd) {
super(cmd);
Argument
this._cmd._args.push(this);
Unnamed entity. From command line arguments passed as list of unnamed values.
@namespace
@class Presents argument
*/
exports.Arg = Arg = (function() {
/**
@constructs
@param {COA.Cmd} cmd parent command
*/
function Arg(_cmd) {
this._cmd = _cmd;
this._cmd._args.push(this);
}
/**
Set a canonical argument identifier to be used anywhere in text messages.
@param {String} _name argument name
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.name = Opt.prototype.name;
/**
Set a long description for argument to be used anywhere in text messages.
@param {String} _title argument title
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.title = Cmd.prototype.title;
/**
Makes an argument accepts multiple values.
Otherwise, the value will be used by the latter passed.
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.arr = Opt.prototype.arr;
/**
Makes an argument required.
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.req = Opt.prototype.req;
/**
Set a validation (or value) function for argument.
Value from command line passes through before becoming available from API.
Using for validation and convertion simple types to any values.
@param {Function} _val validating function,
invoked in the context of argument instance
and has one parameter with value from command line
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.val = Opt.prototype.val;
/**
Set a default value for argument.
Default value passed through validation function as ordinary value.
@param {Object} _def
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.def = Opt.prototype.def;
/**
Set custom additional completion for current argument.
@param {Function} completion generation function,
invoked in the context of argument instance.
Accepts parameters:
- {Object} opts completion options
It can return promise or any other value treated as result.
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.comp = Cmd.prototype.comp;
/**
Make argument value inputting stream.
It's add useful validation and shortcut for STDIN.
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.input = Opt.prototype.input;
/**
Make argument value outputing stream.
It's add useful validation and shortcut for STDOUT.
@returns {COA.Arg} this instance (for chainability)
*/
Arg.prototype.output = Opt.prototype.output;
Arg.prototype._parse = function(arg, args) {
return this._saveVal(args, arg);
};
Arg.prototype._saveVal = Opt.prototype._saveVal;
Arg.prototype._checkParsed = function(opts, args) {
return !args.hasOwnProperty(this._name);
};
Arg.prototype._usage = function() {
var res;
res = [];
res.push(Color('lpurple', this._name.toUpperCase()), ' : ', this._title);
if (this._req) {
res.push(' ', Color('lred', '(required)'));
}
return res.join('');
};
_saveVal(args, val) {
this._val && (val = this._val(val));
Arg.prototype._requiredText = function() {
return 'Missing required argument:\n ' + this._usage();
};
const name = this._name;
this._arr
? (args[name] || (args[name] = [])).push(val)
: (args[name] = val);
/**
Return rejected promise with error code.
Use in .val() for return with error.
@param {Object} reject reason
You can customize toString() method and exitCode property
of reason object.
@returns {Q.promise} rejected promise
*/
return val;
}
_parse(arg, args) {
return this._saveVal(args, arg);
}
Arg.prototype.reject = Cmd.prototype.reject;
_checkParsed(opts, args) {
return !args.hasOwnProperty(this._name);
}
/**
Finish chain for current option and return parent command instance.
@returns {COA.Cmd} parent command
*/
_usage() {
const res = [];
res.push(chalk.magentaBright(this._name.toUpperCase()), ' : ', this._title);
Arg.prototype.end = Cmd.prototype.end;
this._req && res.push(' ', chalk.redBright('(required)'));
/**
Apply function with arguments in context of arg instance.
@param {Function} fn
@param {Array} args
@returns {COA.Arg} this instance (for chainability)
*/
return res.join('');
}
_requiredText() {
return `Missing required argument:\n ${this._usage()}`;
}
};
Arg.prototype.apply = Cmd.prototype.apply;
return Arg;
})();

1000
node_modules/coa/lib/cmd.js generated vendored

File diff suppressed because it is too large Load Diff

101
node_modules/coa/lib/coaobject.js generated vendored
View File

@@ -1,101 +0,0 @@
/* eslint-disable class-methods-use-this */
'use strict';
const Q = require('q');
/**
* COA Object
*
* Base class for all COA-related objects
*
* --------|-----|-----|-----
* | Cmd | Opt | Arg
* --------|-----|-----|-----
* name | ✓ | ✓ | ✓
* title | ✓ | ✓ | ✓
* comp | ✓ | ✓ | ✓
* reject | ✓ | ✓ | ✓
* end | ✓ | ✓ | ✓
* apply | ✓ | ✓ | ✓
*
* @class CoaObject
*/
module.exports = class CoaObject {
constructor(cmd) {
this._cmd = cmd;
this._name = null;
this._title = null;
this._comp = null;
}
/**
* Set a canonical identifier to be used anywhere in the API.
*
* @param {String} name - command, option or argument name
* @returns {COA.CoaObject} - this instance (for chainability)
*/
name(name) {
this._name = name;
return this;
}
/**
* Set a long description to be used anywhere in text messages.
* @param {String} title - human readable entity title
* @returns {COA.CoaObject} - this instance (for chainability)
*/
title(title) {
this._title = title;
return this;
}
/**
* Set custom additional completion for current object.
*
* @param {Function} comp - completion generation function,
* invoked in the context of object instance.
* Accepts parameters:
* - {Object} opts - completion options
* It can return promise or any other value threated as a result.
* @returns {COA.CoaObject} - this instance (for chainability)
*/
comp(comp) {
this._comp = comp;
return this;
}
/**
* Apply function with arguments in a context of object instance.
*
* @param {Function} fn - body
* @param {Array.<*>} args... - arguments
* @returns {COA.CoaObject} - this instance (for chainability)
*/
apply(fn) {
arguments.length > 1?
fn.apply(this, [].slice.call(arguments, 1))
: fn.call(this);
return this;
}
/**
* Return reject of actions results promise with error code.
* Use in .act() for return with error.
* @param {Object} reason - reject reason
* You can customize toString() method and exitCode property
* of reason object.
* @returns {Q.promise} rejected promise
*/
reject(reason) {
return Q.reject(reason);
}
/**
* Finish chain for current subcommand and return parent command instance.
* @returns {COA.Cmd} parent command
*/
end() {
return this._cmd;
}
};

125
node_modules/coa/lib/coaparam.js generated vendored
View File

@@ -1,125 +0,0 @@
'use strict';
const fs = require('fs');
const CoaObject = require('./coaobject');
/**
* COA Parameter
*
* Base class for options and arguments
*
* --------|-----|-----|-----
* | Cmd | Opt | Arg
* --------|-----|-----|-----
* arr | | ✓ | ✓
* req | | ✓ | ✓
* val | | ✓ | ✓
* def | | ✓ | ✓
* input | | ✓ | ✓
* output | | ✓ | ✓
*
* @class CoaParam
* @extends CoaObject
*/
module.exports = class CoaParam extends CoaObject {
constructor(cmd) {
super(cmd);
this._arr = false;
this._req = false;
this._val = undefined;
this._def = undefined;
}
/**
* Makes a param accepts multiple values.
* Otherwise, the value will be used by the latter passed.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
arr() {
this._arr = true;
return this;
}
/**
* Makes a param required.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
req() {
this._req = true;
return this;
}
/**
* Set a validation (or value) function for param.
* Value from command line passes through before becoming available from API.
* Using for validation and convertion simple types to any values.
*
* @param {Function} val - validating function,
* invoked in the context of option instance
* and has one parameter with value from command line.
* @returns {COA.CoaParam} - this instance (for chainability)
*/
val(val) {
this._val = val;
return this;
}
/**
* Set a default value for param.
* Default value passed through validation function as ordinary value.
*
* @param {*} def - default value of function generator
* @returns {COA.CoaParam} - this instance (for chainability)
*/
def(def) {
this._def = def;
return this;
}
/**
* Make option value inputting stream.
* It's add useful validation and shortcut for STDIN.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
input() {
process.stdin.pause();
return this
.def(process.stdin)
.val(function(v) {
if(typeof v !== 'string')
return v;
if(v === '-')
return process.stdin;
const s = fs.createReadStream(v, { encoding : 'utf8' });
s.pause();
return s;
});
}
/**
* Make option value outputing stream.
* It's add useful validation and shortcut for STDOUT.
*
* @returns {COA.CoaParam} - this instance (for chainability)
*/
output() {
return this
.def(process.stdout)
.val(function(v) {
if(typeof v !== 'string')
return v;
if(v === '-')
return process.stdout;
return fs.createWriteStream(v, { encoding : 'utf8' });
});
}
};

25
node_modules/coa/lib/color.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
// Generated by CoffeeScript 1.6.3
var colors;
colors = {
black: '30',
dgray: '1;30',
red: '31',
lred: '1;31',
green: '32',
lgreen: '1;32',
brown: '33',
yellow: '1;33',
blue: '34',
lblue: '1;34',
purple: '35',
lpurple: '1;35',
cyan: '36',
lcyan: '1;36',
lgray: '37',
white: '1;37'
};
exports.Color = function(c, str) {
return ['\x1B[', colors[c], 'm', str, '\x1B[m'].join('');
};

288
node_modules/coa/lib/completion.js generated vendored
View File

@@ -1,176 +1,134 @@
'use strict';
const constants = require('constants');
const fs = require('fs');
const path = require('path');
const Q = require('q');
const shell = require('./shell');
const escape = shell.escape;
const unescape = shell.unescape;
// Generated by CoffeeScript 1.6.3
/**
* Most of the code adopted from the npm package shell completion code.
* See https://github.com/isaacs/npm/blob/master/lib/completion.js
*
* @returns {COA.CoaObject}
*/
module.exports = function completion() {
return this
.title('Shell completion')
.helpful()
.arg()
.name('raw')
.title('Completion words')
.arr()
.end()
.act((opts, args) => {
if(process.platform === 'win32') {
const e = new Error('shell completion not supported on windows');
e.code = 'ENOTSUP';
e.errno = constants.ENOTSUP;
return this.reject(e);
}
Most of the code adopted from the npm package shell completion code.
See https://github.com/isaacs/npm/blob/master/lib/completion.js
*/
// if the COMP_* isn't in the env, then just dump the script
if((process.env.COMP_CWORD == null)
|| (process.env.COMP_LINE == null)
|| (process.env.COMP_POINT == null)) {
return dumpScript(this._cmd._name);
}
var Q, complete, dumpScript, escape, getOpts, unescape;
console.error('COMP_LINE: %s', process.env.COMP_LINE);
console.error('COMP_CWORD: %s', process.env.COMP_CWORD);
console.error('COMP_POINT: %s', process.env.COMP_POINT);
console.error('args: %j', args.raw);
Q = require('q');
// completion opts
opts = getOpts(args.raw);
escape = require('./shell').escape;
// cmd
const parsed = this._cmd._parseCmd(opts.partialWords);
return Q.when(complete(parsed.cmd, parsed.opts), compls => {
console.error('filtered: %j', compls);
return console.log(compls.map(escape).join('\n'));
});
});
unescape = require('./shell').unescape;
module.exports = function() {
return this.title('Shell completion').helpful().arg().name('raw').title('Completion words').arr().end().act(function(opts, args) {
var argv, cmd, e, _ref;
if (process.platform === 'win32') {
e = new Error('shell completion not supported on windows');
e.code = 'ENOTSUP';
e.errno = require('constants').ENOTSUP;
return this.reject(e);
}
if ((process.env.COMP_CWORD == null) || (process.env.COMP_LINE == null) || (process.env.COMP_POINT == null)) {
return dumpScript(this._cmd._name);
}
console.error('COMP_LINE: %s', process.env.COMP_LINE);
console.error('COMP_CWORD: %s', process.env.COMP_CWORD);
console.error('COMP_POINT: %s', process.env.COMP_POINT);
console.error('args: %j', args.raw);
opts = getOpts(args.raw);
_ref = this._cmd._parseCmd(opts.partialWords), cmd = _ref.cmd, argv = _ref.argv;
return Q.when(complete(cmd, opts), function(compls) {
console.error('filtered: %j', compls);
return console.log(compls.map(escape).join('\n'));
});
});
};
function dumpScript(name) {
const defer = Q.defer();
fs.readFile(path.resolve(__dirname, 'completion.sh'), 'utf8', function(err, d) {
if(err) return defer.reject(err);
d = d.replace(/{{cmd}}/g, path.basename(name)).replace(/^#!.*?\n/, '');
process.stdout.on('error', onError);
process.stdout.write(d, () => defer.resolve());
});
return defer.promise;
function onError(err) {
// Darwin is a real dick sometimes.
//
// This is necessary because the "source" or "." program in
// bash on OS X closes its file argument before reading
// from it, meaning that you get exactly 1 write, which will
// work most of the time, and will always raise an EPIPE.
//
// Really, one should not be tossing away EPIPE errors, or any
// errors, so casually. But, without this, `. <(cmd completion)`
// can never ever work on OS X.
if(err.errno !== constants.EPIPE) return defer.reject(err);
dumpScript = function(name) {
var defer, fs, path;
fs = require('fs');
path = require('path');
defer = Q.defer();
fs.readFile(path.resolve(__dirname, 'completion.sh'), 'utf8', function(err, d) {
var onError;
if (err) {
return defer.reject(err);
}
d = d.replace(/{{cmd}}/g, path.basename(name)).replace(/^\#\!.*?\n/, '');
onError = function(err) {
if (err.errno === require('constants').EPIPE) {
process.stdout.removeListener('error', onError);
return defer.resolve();
}
}
function getOpts(argv) {
// get the partial line and partial word, if the point isn't at the end
// ie, tabbing at: cmd foo b|ar
const line = process.env.COMP_LINE;
const w = +process.env.COMP_CWORD;
const point = +process.env.COMP_POINT;
const words = argv.map(unescape);
const word = words[w];
const partialLine = line.substr(0, point);
const partialWords = words.slice(0, w);
// figure out where in that last word the point is
let partialWord = argv[w] || '';
let i = partialWord.length;
while(partialWord.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) i--;
partialWord = unescape(partialWord.substr(0, i));
partialWord && partialWords.push(partialWord);
return {
line,
w,
point,
words,
word,
partialLine,
partialWords,
partialWord
} else {
return defer.reject(err);
}
};
}
function complete(cmd, opts) {
let optWord, optPrefix,
compls = [];
// Complete on cmds
if(opts.partialWord.indexOf('-'))
compls = Object.keys(cmd._cmdsByName);
// Complete on required opts without '-' in last partial word
// (if required not already specified)
//
// Commented out because of uselessness:
// -b, --block suggest results in '-' on cmd line;
// next completion suggest all options, because of '-'
//.concat Object.keys(cmd._optsByKey).filter (v) -> cmd._optsByKey[v]._req
else {
// complete on opt values: --opt=| case
const m = opts.partialWord.match(/^(--\w[\w-_]*)=(.*)$/);
if(m) {
optWord = m[1];
optPrefix = optWord + '=';
} else
// complete on opts
// don't complete on opts in case of --opt=val completion
// TODO: don't complete on opts in case of unknown arg after commands
// TODO: complete only on opts with arr() or not already used
// TODO: complete only on full opts?
compls = Object.keys(cmd._optsByKey);
}
// complete on opt values: next arg case
opts.partialWords[opts.w - 1].indexOf('-') || (optWord = opts.partialWords[opts.w - 1]);
// complete on opt values: completion
let opt;
optWord
&& (opt = cmd._optsByKey[optWord])
&& !opt._flag
&& opt._comp
&& (compls = Q.join(compls,
Q.when(opt._comp(opts),
(c, o) => c.concat(o.map(v => (optPrefix || '') + v)))));
// TODO: complete on args values (context aware, custom completion?)
// custom completion on cmds
cmd._comp && (compls = Q.join(compls, Q.when(cmd._comp(opts)), (c, o) => c.concat(o)));
// TODO: context aware custom completion on cmds, opts and args
// (can depend on already entered values, especially options)
return Q.when(compls, complitions => {
console.error('partialWord: %s', opts.partialWord);
console.error('compls: %j', complitions);
return compls.filter(c => c.indexOf(opts.partialWord) === 0);
process.stdout.on('error', onError);
return process.stdout.write(d, function() {
return defer.resolve();
});
}
});
return defer.promise;
};
getOpts = function(argv) {
var i, line, partialLine, partialWord, partialWords, point, w, word, words;
line = process.env.COMP_LINE;
w = +process.env.COMP_CWORD;
point = +process.env.COMP_POINT;
words = argv.map(unescape);
word = words[w];
partialLine = line.substr(0, point);
partialWords = words.slice(0, w);
partialWord = argv[w] || '';
i = partialWord.length;
while (partialWord.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) {
i--;
}
partialWord = unescape(partialWord.substr(0, i));
if (partialWord) {
partialWords.push(partialWord);
}
return {
line: line,
w: w,
point: point,
words: words,
word: word,
partialLine: partialLine,
partialWords: partialWords,
partialWord: partialWord
};
};
complete = function(cmd, opts) {
var compls, m, o, opt, optPrefix, optWord;
compls = [];
if (opts.partialWord.indexOf('-')) {
compls = Object.keys(cmd._cmdsByName);
} else {
if (m = opts.partialWord.match(/^(--\w[\w-_]*)=(.*)$/)) {
optWord = m[1];
optPrefix = optWord + '=';
} else {
compls = Object.keys(cmd._optsByKey);
}
}
if (!(o = opts.partialWords[opts.w - 1]).indexOf('-')) {
optWord = o;
}
if (optWord && (opt = cmd._optsByKey[optWord])) {
if (!opt._flag && opt._comp) {
compls = Q.join(compls, Q.when(opt._comp(opts), function(c, o) {
return c.concat(o.map(function(v) {
return (optPrefix || '') + v;
}));
}));
}
}
if (cmd._comp) {
compls = Q.join(compls, Q.when(cmd._comp(opts)), function(c, o) {
return c.concat(o);
});
}
return Q.when(compls, function(compls) {
console.error('partialWord: %s', opts.partialWord);
console.error('compls: %j', compls);
return compls.filter(function(c) {
return c.indexOf(opts.partialWord) === 0;
});
});
};

22
node_modules/coa/lib/index.js generated vendored
View File

@@ -1,14 +1,10 @@
const
Cmd = require('./cmd'),
Opt = require('./opt'),
Arg = require('./arg'),
shell = require('./shell');
// Generated by CoffeeScript 1.6.3
exports.Cmd = require('./cmd').Cmd;
module.exports = {
Cmd : Cmd.create,
Opt : Opt.create,
Arg : Arg.create,
classes : { Cmd, Opt, Arg },
shell,
require
};
exports.Opt = require('./cmd').Opt;
exports.Arg = require('./cmd').Arg;
exports.shell = require('./shell');
exports.require = require;

437
node_modules/coa/lib/opt.js generated vendored
View File

@@ -1,155 +1,338 @@
'use strict';
// Generated by CoffeeScript 1.6.3
var Cmd, Color, Opt, Q, fs;
const
Q = require('q'),
fs = require('fs');
CoaParam = require('./coaparam'),
chalk = require('chalk');
Q = require('q');
Color = require('./color').Color;
Cmd = require('./cmd').Cmd;
/**
* Option
*
* Named entity. Options may have short and long keys for use from command line.
*
* @namespace
* @class Opt
* @extends CoaParam
*/
module.exports = class Opt extends CoaParam {
/**
* @constructs
* @param {COA.Cmd} cmd - parent command
*/
constructor(cmd) {
super(cmd);
Option
this._short = null;
this._long = null;
this._flag = false;
this._only = false;
this._cmd._opts.push(this);
}
Named entity. Options may have short and long keys for use from command line.
@namespace
@class Presents option
*/
/**
* Set a short key for option to be used with one hyphen from command line.
*
* @param {String} short - short name
* @returns {COA.Opt} - this instance (for chainability)
*/
short(short) {
this._short = short;
this._cmd._optsByKey[`-${short}`] = this;
return this;
}
/**
* Set a short key for option to be used with double hyphens from command line.
*
* @param {String} long - long name
* @returns {COA.Opt} - this instance (for chainability)
*/
long(long) {
this._long = long;
this._cmd._optsByKey[`--${long}`] = this;
return this;
}
exports.Opt = Opt = (function() {
/**
@constructs
@param {COA.Cmd} cmd parent command
*/
/**
* Make an option boolean, i.e. option without value.
*
* @returns {COA.Opt} - this instance (for chainability)
*/
flag() {
this._flag = true;
return this;
}
function Opt(_cmd) {
this._cmd = _cmd;
this._cmd._opts.push(this);
}
/**
* Makes an option to act as a command,
* i.e. program will exit just after option action.
*
* @returns {COA.Opt} - this instance (for chainability)
*/
only() {
this._only = true;
return this;
}
/**
Set a canonical option identifier to be used anywhere in the API.
@param {String} _name option name
@returns {COA.Opt} this instance (for chainability)
*/
/**
* Add action for current option command.
* This action is performed if the current option
* is present in parsed options (with any value).
*
* @param {Function} act - action function,
* invoked in the context of command instance
* and has the parameters:
* - {Object} opts - parsed options
* - {Array} args - parsed arguments
* - {Object} res - actions result accumulator
* It can return rejected promise by Cmd.reject (in case of error)
* or any other value treated as result.
* @returns {COA.Opt} - this instance (for chainability)
*/
act(act) {
// Need function here for arguments
const opt = this;
this._cmd.act(function(opts) {
if(!opts.hasOwnProperty(opt._name)) return;
const res = act.apply(this, arguments);
if(!opt._only) return res;
Opt.prototype.name = function(_name) {
this._name = _name;
return this;
};
return Q.when(res, out => this.reject({
toString : () => out.toString(),
exitCode : 0
}));
});
/**
Set a long description for option to be used anywhere in text messages.
@param {String} _title option title
@returns {COA.Opt} this instance (for chainability)
*/
return this;
}
_saveVal(opts, val) {
this._val && (val = this._val(val));
Opt.prototype.title = Cmd.prototype.title;
const name = this._name;
this._arr
? (opts[name] || (opts[name] = [])).push(val)
: (opts[name] = val);
/**
Set a short key for option to be used with one hyphen from command line.
@param {String} _short
@returns {COA.Opt} this instance (for chainability)
*/
return val;
}
_parse(argv, opts) {
return this._saveVal(opts, this._flag ? true : argv.shift());
}
Opt.prototype.short = function(_short) {
this._short = _short;
return this._cmd._optsByKey['-' + _short] = this;
};
_checkParsed(opts) {
return !opts.hasOwnProperty(this._name);
}
/**
Set a short key for option to be used with double hyphens from command line.
@param {String} _long
@returns {COA.Opt} this instance (for chainability)
*/
_usage() {
const res = [],
nameStr = this._name.toUpperCase();
if(this._short) {
res.push('-', chalk.greenBright(this._short));
this._flag || res.push(' ' + nameStr);
res.push(', ');
Opt.prototype.long = function(_long) {
this._long = _long;
return this._cmd._optsByKey['--' + _long] = this;
};
/**
Make an option boolean, i.e. option without value.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.flag = function() {
this._flag = true;
return this;
};
/**
Makes an option accepts multiple values.
Otherwise, the value will be used by the latter passed.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.arr = function() {
this._arr = true;
return this;
};
/**
Makes an option required.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.req = function() {
this._req = true;
return this;
};
/**
Makes an option to act as a command,
i.e. program will exit just after option action.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.only = function() {
this._only = true;
return this;
};
/**
Set a validation (or value) function for option.
Value from command line passes through before becoming available from API.
Using for validation and convertion simple types to any values.
@param {Function} _val validating function,
invoked in the context of option instance
and has one parameter with value from command line
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.val = function(_val) {
this._val = _val;
return this;
};
/**
Set a default value for option.
Default value passed through validation function as ordinary value.
@param {Object} _def
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.def = function(_def) {
this._def = _def;
return this;
};
/**
Make option value inputting stream.
It's add useful validation and shortcut for STDIN.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.input = function() {
process.stdin.pause();
return this.def(process.stdin).val(function(v) {
var s;
if (typeof v === 'string') {
if (v === '-') {
return process.stdin;
} else {
s = fs.createReadStream(v, {
encoding: 'utf8'
});
s.pause();
return s;
}
} else {
return v;
}
});
};
if(this._long) {
res.push('--', chalk.green(this._long));
this._flag || res.push('=' + nameStr);
/**
Make option value outputing stream.
It's add useful validation and shortcut for STDOUT.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.output = function() {
return this.def(process.stdout).val(function(v) {
if (typeof v === 'string') {
if (v === '-') {
return process.stdout;
} else {
return fs.createWriteStream(v, {
encoding: 'utf8'
});
}
} else {
return v;
}
});
};
res.push(' : ', this._title);
/**
Add action for current option command.
This action is performed if the current option
is present in parsed options (with any value).
@param {Function} act action function,
invoked in the context of command instance
and has the parameters:
- {Object} opts parsed options
- {Array} args parsed arguments
- {Object} res actions result accumulator
It can return rejected promise by Cmd.reject (in case of error)
or any other value treated as result.
@returns {COA.Opt} this instance (for chainability)
*/
this._req && res.push(' ', chalk.redBright('(required)'));
return res.join('');
Opt.prototype.act = function(act) {
var name, opt;
opt = this;
name = this._name;
this._cmd.act(function(opts) {
var res,
_this = this;
if (name in opts) {
res = act.apply(this, arguments);
if (opt._only) {
return Q.when(res, function(res) {
return _this.reject({
toString: function() {
return res.toString();
},
exitCode: 0
});
});
} else {
return res;
}
}
});
return this;
};
/**
Set custom additional completion for current option.
@param {Function} completion generation function,
invoked in the context of option instance.
Accepts parameters:
- {Object} opts completion options
It can return promise or any other value treated as result.
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.comp = Cmd.prototype.comp;
Opt.prototype._saveVal = function(opts, val) {
var _name;
if (this._val) {
val = this._val(val);
}
_requiredText() {
return `Missing required option:\n ${this._usage()}`;
if (this._arr) {
(opts[_name = this._name] || (opts[_name] = [])).push(val);
} else {
opts[this._name] = val;
}
};
return val;
};
Opt.prototype._parse = function(argv, opts) {
return this._saveVal(opts, this._flag ? true : argv.shift());
};
Opt.prototype._checkParsed = function(opts, args) {
return !opts.hasOwnProperty(this._name);
};
Opt.prototype._usage = function() {
var nameStr, res;
res = [];
nameStr = this._name.toUpperCase();
if (this._short) {
res.push('-', Color('lgreen', this._short));
if (!this._flag) {
res.push(' ' + nameStr);
}
res.push(', ');
}
if (this._long) {
res.push('--', Color('green', this._long));
if (!this._flag) {
res.push('=' + nameStr);
}
}
res.push(' : ', this._title);
if (this._req) {
res.push(' ', Color('lred', '(required)'));
}
return res.join('');
};
Opt.prototype._requiredText = function() {
return 'Missing required option:\n ' + this._usage();
};
/**
Return rejected promise with error code.
Use in .val() for return with error.
@param {Object} reject reason
You can customize toString() method and exitCode property
of reason object.
@returns {Q.promise} rejected promise
*/
Opt.prototype.reject = Cmd.prototype.reject;
/**
Finish chain for current option and return parent command instance.
@returns {COA.Cmd} parent command
*/
Opt.prototype.end = Cmd.prototype.end;
/**
Apply function with arguments in context of option instance.
@param {Function} fn
@param {Array} args
@returns {COA.Opt} this instance (for chainability)
*/
Opt.prototype.apply = Cmd.prototype.apply;
return Opt;
})();

26
node_modules/coa/lib/shell.js generated vendored
View File

@@ -1,14 +1,14 @@
module.exports = { escape, unescape };
// Generated by CoffeeScript 1.6.3
exports.unescape = function(w) {
w = w.charAt(0) === '"' ? w.replace(/^"|([^\\])"$/g, '$1') : w.replace(/\\ /g, ' ');
return w.replace(/\\("|'|\$|`|\\)/g, '$1');
};
function unescape(w) {
w = w.charAt(0) === '"'
? w.replace(/^"|([^\\])"$/g, '$1')
: w.replace(/\\ /g, ' ');
return w.replace(/\\("|'|\$|`|\\)/g, '$1');
}
function escape(w) {
w = w.replace(/(["'$`\\])/g,'\\$1');
return w.match(/\s+/) ? `"${w}"` : w;
}
exports.escape = function(w) {
w = w.replace(/(["'$`\\])/g, '\\$1');
if (w.match(/\s+/)) {
return '"' + w + '"';
} else {
return w;
}
};

37
node_modules/coa/package.json generated vendored
View File

@@ -1,7 +1,7 @@
{
"name": "coa",
"description": "Command-Option-Argument: Yet another parser for command line options.",
"version": "2.0.2",
"version": "1.0.4",
"homepage": "http://github.com/veged/coa",
"author": "Sergey Berezhnoy <veged@ya.ru> (http://github.com/veged)",
"maintainers": [
@@ -11,12 +11,6 @@
"contributors": [
"Sergey Belov <peimei@ya.ru> (http://github.com/arikon)"
],
"files": [
"lib/",
"index.js",
"coa.d.ts",
"README.ru.md"
],
"repository": {
"type": "git",
"url": "git://github.com/veged/coa.git"
@@ -25,29 +19,26 @@
"lib": "./lib"
},
"dependencies": {
"@types/q": "^1.5.1",
"chalk": "^2.4.1",
"q": "^1.1.2"
},
"devDependencies": {
"chai": "~1.7.2",
"coveralls": "^2.11.16",
"eslint": "^4.15.0",
"eslint-config-pedant": "^1.0.0",
"coffee-script": "~1.6.3",
"istanbul": "~0.1.40",
"mocha-istanbul": "*",
"mocha": "~1.21.4",
"nyc": "^10.1.2"
"chai": "~1.7.2"
},
"scripts": {
"clean": "rm -r .nyc_output coverage",
"coverage": "nyc --reporter=text --reporter=html mocha; echo; echo 'Open coverage/index.html file in your browser'",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha"
"test": "make test",
"coverage": "make coverage"
},
"engines": {
"node": ">= 4.0"
"node": ">= 0.8.0"
},
"types": "./coa.d.ts",
"license": "MIT"
"licenses": [
{
"type": "MIT"
}
],
"optionalDependencies": {}
}

17
node_modules/coa/qq.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
const run = require('./test/util').run;
// run(cmd => cmd.arg().name('qwe').end().arg().name('zxc').end().act(function(opts, args) { console.log({opts, args}); }), ['qwe', 'zxc']) // cmd and args
// .then(res => {
// // code
// // stdout
// // stderr
// console.log(res);
// });
run(cmd => cmd.opt().name('version').short('v').only().flag().act((opts) => { return 'aasd'; }), ['-v']) // cmd and args
.then(res => {
// code
// stdout
// stderr
console.log(res);
});

130
node_modules/coa/src/arg.coffee generated vendored Normal file
View File

@@ -0,0 +1,130 @@
Color = require('./color').Color
Cmd = require('./cmd').Cmd
Opt = require('./opt').Opt
###*
Argument
Unnamed entity. From command line arguments passed as list of unnamed values.
@namespace
@class Presents argument
###
exports.Arg = class Arg
###*
@constructs
@param {COA.Cmd} cmd parent command
###
constructor: (@_cmd) -> @_cmd._args.push @
###*
Set a canonical argument identifier to be used anywhere in text messages.
@param {String} _name argument name
@returns {COA.Arg} this instance (for chainability)
###
name: Opt::name
###*
Set a long description for argument to be used anywhere in text messages.
@param {String} _title argument title
@returns {COA.Arg} this instance (for chainability)
###
title: Cmd::title
###*
Makes an argument accepts multiple values.
Otherwise, the value will be used by the latter passed.
@returns {COA.Arg} this instance (for chainability)
###
arr: Opt::arr
###*
Makes an argument required.
@returns {COA.Arg} this instance (for chainability)
###
req: Opt::req
###*
Set a validation (or value) function for argument.
Value from command line passes through before becoming available from API.
Using for validation and convertion simple types to any values.
@param {Function} _val validating function,
invoked in the context of argument instance
and has one parameter with value from command line
@returns {COA.Arg} this instance (for chainability)
###
val: Opt::val
###*
Set a default value for argument.
Default value passed through validation function as ordinary value.
@param {Object} _def
@returns {COA.Arg} this instance (for chainability)
###
def: Opt::def
###*
Set custom additional completion for current argument.
@param {Function} completion generation function,
invoked in the context of argument instance.
Accepts parameters:
- {Object} opts completion options
It can return promise or any other value treated as result.
@returns {COA.Arg} this instance (for chainability)
###
comp: Cmd::comp
###*
Make argument value inputting stream.
It's add useful validation and shortcut for STDIN.
@returns {COA.Arg} this instance (for chainability)
###
input: Opt::input
###*
Make argument value outputing stream.
It's add useful validation and shortcut for STDOUT.
@returns {COA.Arg} this instance (for chainability)
###
output: Opt::output
_parse: (arg, args) ->
@_saveVal(args, arg)
_saveVal: Opt::_saveVal
_checkParsed: (opts, args) -> not args.hasOwnProperty(@_name)
_usage: ->
res = []
res.push Color('lpurple', @_name.toUpperCase()), ' : ', @_title
if @_req then res.push ' ', Color('lred', '(required)')
res.join ''
_requiredText: -> 'Missing required argument:\n ' + @_usage()
###*
Return rejected promise with error code.
Use in .val() for return with error.
@param {Object} reject reason
You can customize toString() method and exitCode property
of reason object.
@returns {Q.promise} rejected promise
###
reject: Cmd::reject
###*
Finish chain for current option and return parent command instance.
@returns {COA.Cmd} parent command
###
end: Cmd::end
###*
Apply function with arguments in context of arg instance.
@param {Function} fn
@param {Array} args
@returns {COA.Arg} this instance (for chainability)
###
apply: Cmd::apply

456
node_modules/coa/src/cmd.coffee generated vendored Normal file
View File

@@ -0,0 +1,456 @@
UTIL = require 'util'
PATH = require 'path'
Color = require('./color').Color
Q = require('q')
#inspect = require('eyes').inspector { maxLength: 99999, stream: process.stderr }
###*
Command
Top level entity. Commands may have options and arguments.
@namespace
@class Presents command
###
exports.Cmd = class Cmd
###*
@constructs
@param {COA.Cmd} [cmd] parent command
###
constructor: (cmd) ->
if this not instanceof Cmd
return new Cmd cmd
@_parent cmd
@_cmds = []
@_cmdsByName = {}
@_opts = []
@_optsByKey = {}
@_args = []
@_ext = false
@get: (propertyName, func) ->
Object.defineProperty @::, propertyName,
configurable: true
enumerable: true
get: func
###*
Returns object containing all its subcommands as methods
to use from other programs.
@returns {Object}
###
@get 'api', () ->
if not @_api
@_api = => @invoke.apply @, arguments
for c of @_cmdsByName
do (c) =>
@_api[c] = @_cmdsByName[c].api
@_api
_parent: (cmd) ->
@_cmd = cmd or this
if cmd
cmd._cmds.push @
if @_name then @_cmd._cmdsByName[@_name] = @
@
###*
Set a canonical command identifier to be used anywhere in the API.
@param {String} _name command name
@returns {COA.Cmd} this instance (for chainability)
###
name: (@_name) ->
if @_cmd isnt @ then @_cmd._cmdsByName[_name] = @
@
###*
Set a long description for command to be used anywhere in text messages.
@param {String} _title command title
@returns {COA.Cmd} this instance (for chainability)
###
title: (@_title) -> @
###*
Create new or add existing subcommand for current command.
@param {COA.Cmd} [cmd] existing command instance
@returns {COA.Cmd} new subcommand instance
###
cmd: (cmd) ->
if cmd then cmd._parent @
else new Cmd @
###*
Create option for current command.
@returns {COA.Opt} new option instance
###
opt: -> new (require('./opt').Opt) @
###*
Create argument for current command.
@returns {COA.Opt} new argument instance
###
arg: -> new (require('./arg').Arg) @
###*
Add (or set) action for current command.
@param {Function} act action function,
invoked in the context of command instance
and has the parameters:
- {Object} opts parsed options
- {Array} args parsed arguments
- {Object} res actions result accumulator
It can return rejected promise by Cmd.reject (in case of error)
or any other value treated as result.
@param {Boolean} [force=false] flag for set action instead add to existings
@returns {COA.Cmd} this instance (for chainability)
###
act: (act, force) ->
return @ unless act
if not force and @_act
@_act.push act
else
@_act = [act]
@
###*
Set custom additional completion for current command.
@param {Function} completion generation function,
invoked in the context of command instance.
Accepts parameters:
- {Object} opts completion options
It can return promise or any other value treated as result.
@returns {COA.Cmd} this instance (for chainability)
###
comp: (@_comp) -> @
###*
Apply function with arguments in context of command instance.
@param {Function} fn
@param {Array} args
@returns {COA.Cmd} this instance (for chainability)
###
apply: (fn, args...) ->
fn.apply this, args
@
###*
Make command "helpful", i.e. add -h --help flags for print usage.
@returns {COA.Cmd} this instance (for chainability)
###
helpful: ->
@opt()
.name('help').title('Help')
.short('h').long('help')
.flag()
.only()
.act ->
return @usage()
.end()
###*
Adds shell completion to command, adds "completion" subcommand,
that makes all the magic.
Must be called only on root command.
@returns {COA.Cmd} this instance (for chainability)
###
completable: ->
@cmd()
.name('completion')
.apply(require './completion')
.end()
###*
Allow command to be extendable by external node.js modules.
@param {String} [pattern] Pattern of node.js module to find subcommands at.
@returns {COA.Cmd} this instance (for chainability)
###
extendable: (pattern) ->
@_ext = pattern or true
@
_exit: (msg, code) ->
process.once 'exit', ->
if msg then console.error msg
process.exit code or 0
###*
Build full usage text for current command instance.
@returns {String} usage text
###
usage: ->
res = []
if @_title then res.push @_fullTitle()
res.push('', 'Usage:')
if @_cmds.length then res.push(['', '',
Color('lred', @_fullName()),
Color('lblue', 'COMMAND'),
Color('lgreen', '[OPTIONS]'),
Color('lpurple', '[ARGS]')].join ' ')
if @_opts.length + @_args.length then res.push(['', '',
Color('lred', @_fullName()),
Color('lgreen', '[OPTIONS]'),
Color('lpurple', '[ARGS]')].join ' ')
res.push(
@_usages(@_cmds, 'Commands'),
@_usages(@_opts, 'Options'),
@_usages(@_args, 'Arguments'))
res.join '\n'
_usage: ->
Color('lblue', @_name) + ' : ' + @_title
_usages: (os, title) ->
unless os.length then return
res = ['', title + ':']
for o in os
res.push ' ' + o._usage()
res.join '\n'
_fullTitle: ->
(if @_cmd is this then '' else @_cmd._fullTitle() + '\n') + @_title
_fullName: ->
(if this._cmd is this then '' else @_cmd._fullName() + ' ') + PATH.basename(@_name)
_ejectOpt: (opts, opt) ->
if (pos = opts.indexOf(opt)) >= 0
if opts[pos]._arr
opts[pos]
else
opts.splice(pos, 1)[0]
_checkRequired: (opts, args) ->
if not (@_opts.filter (o) -> o._only and o._name of opts).length
all = @_opts.concat @_args
while i = all.shift()
if i._req and i._checkParsed opts, args
return @reject i._requiredText()
_parseCmd: (argv, unparsed = []) ->
argv = argv.concat()
optSeen = false
while i = argv.shift()
if not i.indexOf '-'
optSeen = true
if not optSeen and /^\w[\w-_]*$/.test(i)
cmd = @_cmdsByName[i]
if not cmd and @_ext
# construct package name to require
if typeof @_ext is 'string'
if ~@_ext.indexOf('%s')
# use formatted string
pkg = UTIL.format(@_ext, i)
else
# just append subcommand name to the prefix
pkg = @_ext + i
else if @_ext is true
# use default scheme: <command>-<subcommand>-<subcommand> and so on
pkg = i
c = @
loop
pkg = c._name + '-' + pkg
if c._cmd is c then break
c = c._cmd
try
cmdDesc = require(pkg)
catch e
if cmdDesc
if typeof cmdDesc == 'function'
# set create subcommand, set its name and apply imported function
@cmd()
.name(i)
.apply(cmdDesc)
.end()
else if typeof cmdDesc == 'object'
# register subcommand
@cmd(cmdDesc)
# set command name
cmdDesc.name(i)
else
throw new Error 'Error: Unsupported command declaration type, ' +
'should be function or COA.Cmd() object'
cmd = @_cmdsByName[i]
if cmd
return cmd._parseCmd argv, unparsed
unparsed.push i
{ cmd: @, argv: unparsed }
_parseOptsAndArgs: (argv) ->
opts = {}
args = {}
nonParsedOpts = @_opts.concat()
nonParsedArgs = @_args.concat()
while i = argv.shift()
# opt
if i isnt '--' and not i.indexOf '-'
if m = i.match /^(--\w[\w-_]*)=(.*)$/
i = m[1]
# suppress 'unknown argument' error for flag options with values
if not @_optsByKey[i]._flag
argv.unshift m[2]
if opt = @_ejectOpt nonParsedOpts, @_optsByKey[i]
if Q.isRejected(res = opt._parse argv, opts)
return res
else
return @reject "Unknown option: #{ i }"
# arg
else
if i is '--'
i = argv.splice(0)
i = if Array.isArray(i) then i else [i]
while a = i.shift()
if arg = nonParsedArgs.shift()
if arg._arr then nonParsedArgs.unshift arg
if Q.isRejected(res = arg._parse a, args)
return res
else
return @reject "Unknown argument: #{ a }"
# set defaults
{
opts: @_setDefaults(opts, nonParsedOpts),
args: @_setDefaults(args, nonParsedArgs)
}
_setDefaults: (params, desc) ->
for i in desc
if i._name not of params and '_def' of i
i._saveVal params, i._def
params
_processParams: (params, desc) ->
notExists = []
for i in desc
n = i._name
if n not of params
notExists.push i
continue
vals = params[n]
delete params[n]
if not Array.isArray vals
vals = [vals]
for v in vals
if Q.isRejected(res = i._saveVal(params, v))
return res
# set defaults
@_setDefaults params, notExists
_parseArr: (argv) ->
Q.when @_parseCmd(argv), (p) ->
Q.when p.cmd._parseOptsAndArgs(p.argv), (r) ->
{ cmd: p.cmd, opts: r.opts, args: r.args }
_do: (input) ->
Q.when input, (input) =>
cmd = input.cmd
[@_checkRequired].concat(cmd._act or []).reduce(
(res, act) ->
Q.when res, (res) ->
act.call(
cmd
input.opts
input.args
res)
undefined
)
###*
Parse arguments from simple format like NodeJS process.argv
and run ahead current program, i.e. call process.exit when all actions done.
@param {Array} argv
@returns {COA.Cmd} this instance (for chainability)
###
run: (argv = process.argv.slice(2)) ->
cb = (code) => (res) =>
if res
@_exit res.stack ? res.toString(), res.exitCode ? code
else
@_exit()
Q.when(@do(argv), cb(0), cb(1)).done()
@
###*
Convenient function to run command from tests.
@param {Array} argv
@returns {Q.Promise}
###
do: (argv) ->
@_do(@_parseArr argv || [])
###*
Invoke specified (or current) command using provided
options and arguments.
@param {String|Array} cmds subcommand to invoke (optional)
@param {Object} opts command options (optional)
@param {Object} args command arguments (optional)
@returns {Q.Promise}
###
invoke: (cmds = [], opts = {}, args = {}) ->
if typeof cmds == 'string'
cmds = cmds.split(' ')
if arguments.length < 3
if not Array.isArray cmds
args = opts
opts = cmds
cmds = []
Q.when @_parseCmd(cmds), (p) =>
if p.argv.length
return @reject "Unknown command: " + cmds.join ' '
Q.all([@_processParams(opts, @_opts), @_processParams(args, @_args)])
.spread (opts, args) =>
@_do({ cmd: p.cmd, opts: opts, args: args })
# catch fails from .only() options
.fail (res) =>
if res and res.exitCode is 0
res.toString()
else
@reject(res)
###*
Return reject of actions results promise with error code.
Use in .act() for return with error.
@param {Object} reject reason
You can customize toString() method and exitCode property
of reason object.
@returns {Q.promise} rejected promise
###
reject: (reason) -> Q.reject(reason)
###*
Finish chain for current subcommand and return parent command instance.
@returns {COA.Cmd} parent command
###
end: -> @_cmd

25
node_modules/coa/src/color.coffee generated vendored Normal file
View File

@@ -0,0 +1,25 @@
colors =
black: '30'
dgray: '1;30'
red: '31'
lred: '1;31'
green: '32'
lgreen: '1;32'
brown: '33'
yellow: '1;33'
blue: '34'
lblue: '1;34'
purple: '35'
lpurple: '1;35'
cyan: '36'
lcyan: '1;36'
lgray: '37'
white: '1;37'
exports.Color = (c, str) ->
# Use \x1B instead of \033 because of CoffeeScript 1.3.x compilation error
[
'\x1B[', colors[c], 'm'
str
'\x1B[m'
].join ''

156
node_modules/coa/src/completion.coffee generated vendored Normal file
View File

@@ -0,0 +1,156 @@
###*
Most of the code adopted from the npm package shell completion code.
See https://github.com/isaacs/npm/blob/master/lib/completion.js
###
Q = require 'q'
escape = require('./shell').escape
unescape = require('./shell').unescape
module.exports = ->
@title('Shell completion')
.helpful()
.arg()
.name('raw')
.title('Completion words')
.arr()
.end()
.act (opts, args) ->
if process.platform == 'win32'
e = new Error 'shell completion not supported on windows'
e.code = 'ENOTSUP'
e.errno = require('constants').ENOTSUP
return @reject(e)
# if the COMP_* isn't in the env, then just dump the script
if !process.env.COMP_CWORD? or !process.env.COMP_LINE? or !process.env.COMP_POINT?
return dumpScript(@_cmd._name)
console.error 'COMP_LINE: %s', process.env.COMP_LINE
console.error 'COMP_CWORD: %s', process.env.COMP_CWORD
console.error 'COMP_POINT: %s', process.env.COMP_POINT
console.error 'args: %j', args.raw
# completion opts
opts = getOpts args.raw
# cmd
{ cmd, argv } = @_cmd._parseCmd opts.partialWords
Q.when complete(cmd, opts), (compls) ->
console.error 'filtered: %j', compls
console.log compls.map(escape).join('\n')
dumpScript = (name) ->
fs = require 'fs'
path = require 'path'
defer = Q.defer()
fs.readFile path.resolve(__dirname, 'completion.sh'), 'utf8', (err, d) ->
if err then return defer.reject err
d = d.replace(/{{cmd}}/g, path.basename name).replace(/^\#\!.*?\n/, '')
onError = (err) ->
# Darwin is a real dick sometimes.
#
# This is necessary because the "source" or "." program in
# bash on OS X closes its file argument before reading
# from it, meaning that you get exactly 1 write, which will
# work most of the time, and will always raise an EPIPE.
#
# Really, one should not be tossing away EPIPE errors, or any
# errors, so casually. But, without this, `. <(cmd completion)`
# can never ever work on OS X.
if err.errno == require('constants').EPIPE
process.stdout.removeListener 'error', onError
defer.resolve()
else
defer.reject(err)
process.stdout.on 'error', onError
process.stdout.write d, -> defer.resolve()
defer.promise
getOpts = (argv) ->
# get the partial line and partial word, if the point isn't at the end
# ie, tabbing at: cmd foo b|ar
line = process.env.COMP_LINE
w = +process.env.COMP_CWORD
point = +process.env.COMP_POINT
words = argv.map unescape
word = words[w]
partialLine = line.substr 0, point
partialWords = words.slice 0, w
# figure out where in that last word the point is
partialWord = argv[w] or ''
i = partialWord.length
while partialWord.substr(0, i) isnt partialLine.substr(-1 * i) and i > 0
i--
partialWord = unescape partialWord.substr 0, i
if partialWord then partialWords.push partialWord
{
line: line
w: w
point: point
words: words
word: word
partialLine: partialLine
partialWords: partialWords
partialWord: partialWord
}
complete = (cmd, opts) ->
compls = []
# complete on cmds
if opts.partialWord.indexOf('-')
compls = Object.keys(cmd._cmdsByName)
# Complete on required opts without '-' in last partial word
# (if required not already specified)
#
# Commented out because of uselessness:
# -b, --block suggest results in '-' on cmd line;
# next completion suggest all options, because of '-'
#.concat Object.keys(cmd._optsByKey).filter (v) -> cmd._optsByKey[v]._req
else
# complete on opt values: --opt=| case
if m = opts.partialWord.match /^(--\w[\w-_]*)=(.*)$/
optWord = m[1]
optPrefix = optWord + '='
else
# complete on opts
# don't complete on opts in case of --opt=val completion
# TODO: don't complete on opts in case of unknown arg after commands
# TODO: complete only on opts with arr() or not already used
# TODO: complete only on full opts?
compls = Object.keys cmd._optsByKey
# complete on opt values: next arg case
if not (o = opts.partialWords[opts.w - 1]).indexOf '-'
optWord = o
# complete on opt values: completion
if optWord and opt = cmd._optsByKey[optWord]
if not opt._flag and opt._comp
compls = Q.join compls, Q.when opt._comp(opts), (c, o) ->
c.concat o.map (v) -> (optPrefix or '') + v
# TODO: complete on args values (context aware, custom completion?)
# custom completion on cmds
if cmd._comp
compls = Q.join compls, Q.when(cmd._comp(opts)), (c, o) ->
c.concat o
# TODO: context aware custom completion on cmds, opts and args
# (can depend on already entered values, especially options)
Q.when compls, (compls) ->
console.error 'partialWord: %s', opts.partialWord
console.error 'compls: %j', compls
compls.filter (c) -> c.indexOf(opts.partialWord) is 0

5
node_modules/coa/src/index.coffee generated vendored Normal file
View File

@@ -0,0 +1,5 @@
exports.Cmd = require('./cmd').Cmd
exports.Opt = require('./cmd').Opt
exports.Arg = require('./cmd').Arg
exports.shell = require('./shell')
exports.require = require;

243
node_modules/coa/src/opt.coffee generated vendored Normal file
View File

@@ -0,0 +1,243 @@
fs = require 'fs'
Q = require 'q'
Color = require('./color').Color
Cmd = require('./cmd').Cmd
###*
Option
Named entity. Options may have short and long keys for use from command line.
@namespace
@class Presents option
###
exports.Opt = class Opt
###*
@constructs
@param {COA.Cmd} cmd parent command
###
constructor: (@_cmd) -> @_cmd._opts.push @
###*
Set a canonical option identifier to be used anywhere in the API.
@param {String} _name option name
@returns {COA.Opt} this instance (for chainability)
###
name: (@_name) -> @
###*
Set a long description for option to be used anywhere in text messages.
@param {String} _title option title
@returns {COA.Opt} this instance (for chainability)
###
title: Cmd::title
###*
Set a short key for option to be used with one hyphen from command line.
@param {String} _short
@returns {COA.Opt} this instance (for chainability)
###
short: (@_short) -> @_cmd._optsByKey['-' + _short] = @
###*
Set a short key for option to be used with double hyphens from command line.
@param {String} _long
@returns {COA.Opt} this instance (for chainability)
###
long: (@_long) -> @_cmd._optsByKey['--' + _long] = @
###*
Make an option boolean, i.e. option without value.
@returns {COA.Opt} this instance (for chainability)
###
flag: () ->
@_flag = true
@
###*
Makes an option accepts multiple values.
Otherwise, the value will be used by the latter passed.
@returns {COA.Opt} this instance (for chainability)
###
arr: ->
@_arr = true
@
###*
Makes an option required.
@returns {COA.Opt} this instance (for chainability)
###
req: ->
@_req = true
@
###*
Makes an option to act as a command,
i.e. program will exit just after option action.
@returns {COA.Opt} this instance (for chainability)
###
only: ->
@_only = true
@
###*
Set a validation (or value) function for option.
Value from command line passes through before becoming available from API.
Using for validation and convertion simple types to any values.
@param {Function} _val validating function,
invoked in the context of option instance
and has one parameter with value from command line
@returns {COA.Opt} this instance (for chainability)
###
val: (@_val) -> @
###*
Set a default value for option.
Default value passed through validation function as ordinary value.
@param {Object} _def
@returns {COA.Opt} this instance (for chainability)
###
def: (@_def) -> @
###*
Make option value inputting stream.
It's add useful validation and shortcut for STDIN.
@returns {COA.Opt} this instance (for chainability)
###
input: ->
# XXX: hack to workaround a bug in node 0.6.x,
# see https://github.com/joyent/node/issues/2130
process.stdin.pause();
@
.def(process.stdin)
.val (v) ->
if typeof v is 'string'
if v is '-'
process.stdin
else
s = fs.createReadStream v, { encoding: 'utf8' }
s.pause()
s
else v
###*
Make option value outputing stream.
It's add useful validation and shortcut for STDOUT.
@returns {COA.Opt} this instance (for chainability)
###
output: ->
@
.def(process.stdout)
.val (v) ->
if typeof v is 'string'
if v is '-'
process.stdout
else
fs.createWriteStream v, { encoding: 'utf8' }
else v
###*
Add action for current option command.
This action is performed if the current option
is present in parsed options (with any value).
@param {Function} act action function,
invoked in the context of command instance
and has the parameters:
- {Object} opts parsed options
- {Array} args parsed arguments
- {Object} res actions result accumulator
It can return rejected promise by Cmd.reject (in case of error)
or any other value treated as result.
@returns {COA.Opt} this instance (for chainability)
###
act: (act) ->
opt = @
name = @_name
@_cmd.act (opts) ->
if name of opts
res = act.apply @, arguments
if opt._only
Q.when res, (res) =>
@reject {
toString: -> res.toString()
exitCode: 0
}
else
res
@
###*
Set custom additional completion for current option.
@param {Function} completion generation function,
invoked in the context of option instance.
Accepts parameters:
- {Object} opts completion options
It can return promise or any other value treated as result.
@returns {COA.Opt} this instance (for chainability)
###
comp: Cmd::comp
_saveVal: (opts, val) ->
if @_val then val = @_val val
if @_arr
(opts[@_name] or= []).push val
else
opts[@_name] = val
val
_parse: (argv, opts) ->
@_saveVal(
opts,
if @_flag
true
else
argv.shift()
)
_checkParsed: (opts, args) -> not opts.hasOwnProperty @_name
_usage: ->
res = []
nameStr = @_name.toUpperCase()
if @_short
res.push '-', Color 'lgreen', @_short
unless @_flag then res.push ' ' + nameStr
res.push ', '
if @_long
res.push '--', Color 'green', @_long
unless @_flag then res.push '=' + nameStr
res.push ' : ', @_title
if @_req then res.push ' ', Color('lred', '(required)')
res.join ''
_requiredText: -> 'Missing required option:\n ' + @_usage()
###*
Return rejected promise with error code.
Use in .val() for return with error.
@param {Object} reject reason
You can customize toString() method and exitCode property
of reason object.
@returns {Q.promise} rejected promise
###
reject: Cmd::reject
###*
Finish chain for current option and return parent command instance.
@returns {COA.Cmd} parent command
###
end: Cmd::end
###*
Apply function with arguments in context of option instance.
@param {Function} fn
@param {Array} args
@returns {COA.Opt} this instance (for chainability)
###
apply: Cmd::apply

10
node_modules/coa/src/shell.coffee generated vendored Normal file
View File

@@ -0,0 +1,10 @@
exports.unescape = (w) ->
w = if w.charAt(0) is '"'
w.replace(/^"|([^\\])"$/g, '$1')
else
w.replace(/\\ /g, ' ')
w.replace(/\\("|'|\$|`|\\)/g, '$1')
exports.escape = (w) ->
w = w.replace(/(["'$`\\])/g,'\\$1')
if w.match(/\s+/) then '"' + w + '"' else w

496
node_modules/coa/test/coa.js generated vendored Normal file
View File

@@ -0,0 +1,496 @@
var assert = require('chai').assert,
COA = require('..');
/**
* Mocha BDD interface.
*/
/** @name describe @function */
/** @name it @function */
/** @name before @function */
/** @name after @function */
/** @name beforeEach @function */
/** @name afterEach @function */
describe('Opt', function() {
describe('Unknown option', function() {
var cmd = COA.Cmd();
it('should fail', function() {
return cmd.do(['-a'])
.then(assert.fail, emptyFn);
});
});
describe('Short options', function() {
var cmd = COA.Cmd()
.opt()
.name('a')
.short('a')
.end()
.opt()
.name('b')
.short('b')
.end()
.act(function(opts) {
return opts;
});
it('should return passed values', function() {
return cmd.do(['-a', 'a', '-b', 'b'])
.then(function(res) {
assert.deepEqual(res, { a: 'a', b: 'b' });
});
});
});
describe('Long options', function() {
var cmd = COA.Cmd()
.opt()
.name('long1')
.long('long1')
.end()
.opt()
.name('long2')
.long('long2')
.end()
.act(function(opts) {
return opts;
});
it('should return passed values', function() {
return cmd.do(['--long1', 'long value', '--long2=another long value'])
.then(function(res) {
assert.deepEqual(res, { long1: 'long value', long2: 'another long value' });
});
});
});
describe('Array option', function() {
var cmd = COA.Cmd()
.opt()
.name('a')
.short('a')
.arr()
.end()
.act(function(opts) {
return opts;
});
it('should return array of passed values', function() {
return cmd.do(['-a', '1', '-a', '2'])
.then(function(res) {
assert.deepEqual(res, { a: ['1', '2'] });
});
});
});
describe('Required option', function() {
var cmd = COA.Cmd()
.opt()
.name('a')
.short('a')
.req()
.end()
.act(function(opts) {
return opts;
});
it('should fail if not specified', function() {
return cmd.do()
.then(assert.fail, emptyFn);
});
it('should return passed value if specified', function() {
return cmd.do(['-a', 'test'])
.then(function(opts) {
assert.equal(opts.a, 'test');
});
});
});
describe('Option with default value', function() {
var cmd = COA.Cmd()
.opt()
.name('a')
.short('a')
.def('aaa')
.end()
.act(function(opts) {
return opts;
});
it('should return default value if not specified', function() {
return cmd.do()
.then(function(opts) {
assert.equal(opts.a, 'aaa');
});
});
it('should return passed value if specified', function() {
return cmd.do(['-a', 'test'])
.then(function(opts) {
assert.equal(opts.a, 'test');
});
});
});
describe('Validated / transformed option', function() {
var cmd = COA.Cmd()
.opt()
.name('a')
.short('a')
.val(function(v) {
if (v === 'invalid') return this.reject('fail');
return { value: v };
})
.end()
.act(function(opts) {
return opts;
});
it('should fail if custom checks suppose to do so', function() {
return cmd.do(['-a', 'invalid'])
.then(assert.fail, emptyFn);
});
it('should return transformed value', function() {
return cmd.do(['-a', 'test'])
.then(function(opts) {
assert.deepEqual(opts.a, { value: 'test' });
});
});
});
describe('Only option (--version case)', function() {
var ver = require('../package.json').version,
cmd = COA.Cmd()
.opt()
.name('version')
.long('version')
.flag()
.only()
.act(function() {
return ver;
})
.end()
.opt()
.name('req')
.short('r')
.req()
.end();
it('should process the only() option', function() {
return cmd.do(['--version'])
.then(assert.fail, function(res) {
assert.equal(res, ver);
});
});
});
it('input()');
it('output()');
});
describe('Arg', function() {
describe('Unknown arg', function() {
var cmd = COA.Cmd();
it('should fail', function() {
return cmd.do(['test'])
.then(assert.fail, emptyFn);
});
});
describe('Unknown arg after known', function() {
var cmd = COA.Cmd()
.arg()
.name('a')
.end();
it('should fail', function() {
return cmd.do(['test', 'unknown'])
.then(assert.fail, emptyFn);
});
});
describe('Array arg', function() {
var cmd = COA.Cmd()
.arg()
.name('a')
.arr()
.end()
.act(function(opts, args) {
return args;
});
it('should return array of passed values', function() {
return cmd.do(['value 1', 'value 2'])
.then(function(args) {
assert.deepEqual(args, { a: ['value 1', 'value 2'] });
});
});
});
describe('Required arg', function() {
var cmd = COA.Cmd()
.arg()
.name('a')
.req()
.end()
.act(function(opts, args) {
return args;
});
it('should fail if not specified', function() {
return cmd.do()
.then(assert.fail, emptyFn);
});
it('should return passed value if specified', function() {
return cmd.do(['value'])
.then(function(args) {
assert.equal(args.a, 'value');
});
});
});
describe('Args after options', function() {
var cmd = COA.Cmd()
.opt()
.name('opt')
.long('opt')
.end()
.arg()
.name('arg1')
.end()
.arg()
.name('arg2')
.arr()
.end()
.act(function(opts, args) {
return { opts: opts, args: args };
});
it('should return passed values', function() {
return cmd.do(['--opt', 'value', 'value', 'value 1', 'value 2'])
.then(function(o) {
assert.deepEqual(o, {
opts: { opt: 'value' },
args: {
arg1: 'value',
arg2: ['value 1', 'value 2']
}
});
});
});
});
describe('Raw args', function() {
var cmd = COA.Cmd()
.arg()
.name('raw')
.arr()
.end()
.act(function(opts, args) {
return args;
});
it('should return passed arg values', function() {
return cmd.do(['--', 'raw', 'arg', 'values'])
.then(function(args) {
assert.deepEqual(args, { raw: ['raw', 'arg', 'values'] });
});
});
});
});
describe('Cmd', function() {
var doTest = function(o) {
assert.deepEqual(o, {
opts: { opt: 'value' },
args: {
arg1: 'value',
arg2: ['value 1', 'value 2']
}
});
},
invokeOpts = { opt: 'value' },
invokeArgs = {
arg1: 'value',
arg2: ['value 1', 'value 2']
};
describe('Subcommand', function() {
var cmd = COA.Cmd()
.cmd()
.name('command')
.opt()
.name('opt')
.long('opt')
.end()
.arg()
.name('arg1')
.end()
.arg()
.name('arg2')
.arr()
.end()
.act(function(opts, args) {
return { opts: opts, args: args };
})
.end();
describe('when specified on command line', function() {
it('should be invoked and accept passed opts and args', function() {
return cmd.do(['command', '--opt', 'value', 'value', 'value 1', 'value 2'])
.then(doTest);
});
});
describe('when invoked using api', function() {
it('should be invoked and accept passed opts and args', function() {
return cmd.api.command(invokeOpts, invokeArgs)
.then(doTest);
});
});
describe('when invoked using invoke()', function() {
it('should be invoked and accept passed opts and args', function() {
return cmd.invoke('command', invokeOpts, invokeArgs)
.then(doTest);
});
});
describe('when unexisting command invoked using invoke()', function() {
it('should fail', function() {
return cmd.invoke('unexistent')
.then(assert.fail, emptyFn);
});
});
});
describe('External subcommand', function() {
describe('default scheme: cmd.extendable()', function() {
describe('when described as a function', function() {
var cmd = COA.Cmd()
.name('coa')
.extendable();
it('should be invoked and accept passed opts and args', function() {
return cmd.do(['test', '--opt', 'value', 'value', 'value 1', 'value 2'])
.then(doTest);
});
});
describe('when described as an COA.Cmd() object', function() {
var cmd = COA.Cmd()
.name('coa')
.extendable();
it('should be invoked and accept passed opts and args', function() {
return cmd.do(['test-obj', '--opt', 'value', 'value', 'value 1', 'value 2'])
.then(doTest);
});
});
describe('2nd level subcommand', function() {
var cmd = COA.Cmd()
.name('coa')
.cmd()
.name('test')
.extendable()
.end();
it('should be invoked and accept passed opts and args', function() {
return cmd.do(['test', 'obj', '--opt', 'value', 'value', 'value 1', 'value 2'])
.then(doTest);
});
});
});
describe("common prefix: cmd.extendable('coa-')", function() {
describe('when described as a function', function() {
var cmd = COA.Cmd()
.name('coa')
.extendable('coa-');
it('should be invoked and accept passed opts and args', function() {
return cmd.do(['test', '--opt', 'value', 'value', 'value 1', 'value 2'])
.then(doTest);
});
});
});
describe("format string: cmd.extendable('coa-%s')", function() {
describe('when described as a function', function() {
var cmd = COA.Cmd()
.name('coa')
.extendable('coa-%s');
it('should be invoked and accept passed opts and args', function() {
return cmd.do(['test', '--opt', 'value', 'value', 'value 1', 'value 2'])
.then(doTest);
});
});
});
});
it('helpful(), name(), title()');
});
function emptyFn() {
// empty function
}

2
node_modules/coa/test/mocha.opts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
--reporter spec
--timeout 20

60
node_modules/coa/test/shell-test.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
var assert = require('chai').assert,
shell = require('..').shell;
/**
* Mocha BDD interface.
*/
/** @name describe @function */
/** @name it @function */
/** @name before @function */
/** @name after @function */
/** @name beforeEach @function */
/** @name afterEach @function */
describe('shell', function() {
describe('escape()', function() {
var escape = shell.escape;
it('Should wrap values with spaces in double quotes', function() {
assert.equal(escape('asd abc'), '"asd abc"');
});
it('Should escape double quote "', function() {
assert.equal(escape('"asd'), '\\"asd');
});
it("Should escape single quote '", function() {
assert.equal(escape("'asd"), "\\'asd");
});
it('Should escape backslash \\', function() {
assert.equal(escape('\\asd'), '\\\\asd');
});
it('Should escape dollar $', function() {
assert.equal(escape('$asd'), '\\$asd');
});
it('Should escape backtick `', function() {
assert.equal(escape('`asd'), '\\`asd');
});
});
describe('unescape()', function() {
var unescape = shell.unescape;
it('Should strip double quotes at the both ends', function() {
assert.equal(unescape('"asd"'), 'asd');
});
it('Should not strip escaped double quotes at the both ends', function() {
assert.equal(unescape('\\"asd\\"'), '"asd"');
});
});
});

9
node_modules/coa/tests/api-h.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
require('..').Cmd()
.name('bla')
.title('Bla bla bla')
.helpful()
.invoke({ help: true })
.then(function(res) {
console.log(res);
})
.done(); // Q.done()

6
node_modules/coa/tests/h.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
var argv = process.argv.slice(2);
require('..').Cmd()
.name('bla')
.title('Bla bla bla')
.helpful()
.run(argv.length? argv : ['-h']);