protobufjs 6.11.2 → 6.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/bin/pbjs +0 -0
- package/bin/pbts +0 -0
- package/package-lock.json +7870 -0
- package/package.json +3 -3
- package/scripts/changelog.js +150 -0
- package/src/util.js +3 -0
- package/cli/node_modules/.package-lock.json +0 -256
- package/cli/node_modules/acorn/CHANGELOG.md +0 -620
- package/cli/node_modules/acorn/LICENSE +0 -21
- package/cli/node_modules/acorn/README.md +0 -269
- package/cli/node_modules/acorn/bin/acorn +0 -4
- package/cli/node_modules/acorn/dist/acorn.d.ts +0 -209
- package/cli/node_modules/acorn/dist/acorn.js +0 -5186
- package/cli/node_modules/acorn/dist/acorn.js.map +0 -1
- package/cli/node_modules/acorn/dist/acorn.mjs +0 -5155
- package/cli/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
- package/cli/node_modules/acorn/dist/acorn.mjs.map +0 -1
- package/cli/node_modules/acorn/dist/bin.js +0 -64
- package/cli/node_modules/acorn/package.json +0 -35
- package/cli/node_modules/acorn-jsx/LICENSE +0 -19
- package/cli/node_modules/acorn-jsx/README.md +0 -40
- package/cli/node_modules/acorn-jsx/index.js +0 -488
- package/cli/node_modules/acorn-jsx/package.json +0 -27
- package/cli/node_modules/acorn-jsx/xhtml.js +0 -255
- package/cli/node_modules/balanced-match/.npmignore +0 -5
- package/cli/node_modules/balanced-match/LICENSE.md +0 -21
- package/cli/node_modules/balanced-match/README.md +0 -91
- package/cli/node_modules/balanced-match/index.js +0 -59
- package/cli/node_modules/balanced-match/package.json +0 -49
- package/cli/node_modules/brace-expansion/LICENSE +0 -21
- package/cli/node_modules/brace-expansion/README.md +0 -129
- package/cli/node_modules/brace-expansion/index.js +0 -201
- package/cli/node_modules/brace-expansion/package.json +0 -47
- package/cli/node_modules/concat-map/.travis.yml +0 -4
- package/cli/node_modules/concat-map/LICENSE +0 -18
- package/cli/node_modules/concat-map/README.markdown +0 -62
- package/cli/node_modules/concat-map/example/map.js +0 -6
- package/cli/node_modules/concat-map/index.js +0 -13
- package/cli/node_modules/concat-map/package.json +0 -43
- package/cli/node_modules/concat-map/test/map.js +0 -39
- package/cli/node_modules/deep-is/.npmignore +0 -1
- package/cli/node_modules/deep-is/.travis.yml +0 -6
- package/cli/node_modules/deep-is/LICENSE +0 -22
- package/cli/node_modules/deep-is/README.markdown +0 -70
- package/cli/node_modules/deep-is/example/cmp.js +0 -11
- package/cli/node_modules/deep-is/index.js +0 -102
- package/cli/node_modules/deep-is/package.json +0 -61
- package/cli/node_modules/deep-is/test/NaN.js +0 -16
- package/cli/node_modules/deep-is/test/cmp.js +0 -23
- package/cli/node_modules/deep-is/test/neg-vs-pos-0.js +0 -15
- package/cli/node_modules/escodegen/LICENSE.BSD +0 -21
- package/cli/node_modules/escodegen/README.md +0 -84
- package/cli/node_modules/escodegen/bin/escodegen.js +0 -77
- package/cli/node_modules/escodegen/bin/esgenerate.js +0 -64
- package/cli/node_modules/escodegen/escodegen.js +0 -2647
- package/cli/node_modules/escodegen/package.json +0 -62
- package/cli/node_modules/eslint-visitor-keys/CHANGELOG.md +0 -25
- package/cli/node_modules/eslint-visitor-keys/LICENSE +0 -201
- package/cli/node_modules/eslint-visitor-keys/README.md +0 -98
- package/cli/node_modules/eslint-visitor-keys/lib/index.js +0 -81
- package/cli/node_modules/eslint-visitor-keys/lib/visitor-keys.json +0 -284
- package/cli/node_modules/eslint-visitor-keys/package.json +0 -40
- package/cli/node_modules/espree/CHANGELOG.md +0 -509
- package/cli/node_modules/espree/LICENSE +0 -25
- package/cli/node_modules/espree/README.md +0 -233
- package/cli/node_modules/espree/espree.js +0 -177
- package/cli/node_modules/espree/lib/ast-node-types.js +0 -96
- package/cli/node_modules/espree/lib/espree.js +0 -286
- package/cli/node_modules/espree/lib/features.js +0 -29
- package/cli/node_modules/espree/lib/options.js +0 -106
- package/cli/node_modules/espree/lib/token-translator.js +0 -263
- package/cli/node_modules/espree/lib/visitor-keys.js +0 -123
- package/cli/node_modules/espree/package.json +0 -64
- package/cli/node_modules/esprima/ChangeLog +0 -235
- package/cli/node_modules/esprima/LICENSE.BSD +0 -21
- package/cli/node_modules/esprima/README.md +0 -46
- package/cli/node_modules/esprima/bin/esparse.js +0 -139
- package/cli/node_modules/esprima/bin/esvalidate.js +0 -236
- package/cli/node_modules/esprima/dist/esprima.js +0 -6709
- package/cli/node_modules/esprima/package.json +0 -112
- package/cli/node_modules/estraverse/.jshintrc +0 -16
- package/cli/node_modules/estraverse/LICENSE.BSD +0 -19
- package/cli/node_modules/estraverse/README.md +0 -153
- package/cli/node_modules/estraverse/estraverse.js +0 -801
- package/cli/node_modules/estraverse/gulpfile.js +0 -70
- package/cli/node_modules/estraverse/package.json +0 -40
- package/cli/node_modules/esutils/LICENSE.BSD +0 -19
- package/cli/node_modules/esutils/README.md +0 -174
- package/cli/node_modules/esutils/lib/ast.js +0 -144
- package/cli/node_modules/esutils/lib/code.js +0 -135
- package/cli/node_modules/esutils/lib/keyword.js +0 -165
- package/cli/node_modules/esutils/lib/utils.js +0 -33
- package/cli/node_modules/esutils/package.json +0 -44
- package/cli/node_modules/fast-levenshtein/LICENSE.md +0 -25
- package/cli/node_modules/fast-levenshtein/README.md +0 -104
- package/cli/node_modules/fast-levenshtein/levenshtein.js +0 -136
- package/cli/node_modules/fast-levenshtein/package.json +0 -39
- package/cli/node_modules/fs.realpath/LICENSE +0 -43
- package/cli/node_modules/fs.realpath/README.md +0 -33
- package/cli/node_modules/fs.realpath/index.js +0 -66
- package/cli/node_modules/fs.realpath/old.js +0 -303
- package/cli/node_modules/fs.realpath/package.json +0 -26
- package/cli/node_modules/glob/LICENSE +0 -21
- package/cli/node_modules/glob/README.md +0 -375
- package/cli/node_modules/glob/changelog.md +0 -67
- package/cli/node_modules/glob/common.js +0 -240
- package/cli/node_modules/glob/glob.js +0 -790
- package/cli/node_modules/glob/package.json +0 -46
- package/cli/node_modules/glob/sync.js +0 -486
- package/cli/node_modules/inflight/LICENSE +0 -15
- package/cli/node_modules/inflight/README.md +0 -37
- package/cli/node_modules/inflight/inflight.js +0 -54
- package/cli/node_modules/inflight/package.json +0 -29
- package/cli/node_modules/inherits/LICENSE +0 -16
- package/cli/node_modules/inherits/README.md +0 -42
- package/cli/node_modules/inherits/inherits.js +0 -9
- package/cli/node_modules/inherits/inherits_browser.js +0 -27
- package/cli/node_modules/inherits/package.json +0 -29
- package/cli/node_modules/levn/LICENSE +0 -22
- package/cli/node_modules/levn/README.md +0 -196
- package/cli/node_modules/levn/lib/cast.js +0 -298
- package/cli/node_modules/levn/lib/coerce.js +0 -285
- package/cli/node_modules/levn/lib/index.js +0 -22
- package/cli/node_modules/levn/lib/parse-string.js +0 -113
- package/cli/node_modules/levn/lib/parse.js +0 -102
- package/cli/node_modules/levn/package.json +0 -47
- package/cli/node_modules/minimatch/LICENSE +0 -15
- package/cli/node_modules/minimatch/README.md +0 -209
- package/cli/node_modules/minimatch/minimatch.js +0 -923
- package/cli/node_modules/minimatch/package.json +0 -30
- package/cli/node_modules/once/LICENSE +0 -15
- package/cli/node_modules/once/README.md +0 -79
- package/cli/node_modules/once/once.js +0 -42
- package/cli/node_modules/once/package.json +0 -33
- package/cli/node_modules/optionator/CHANGELOG.md +0 -56
- package/cli/node_modules/optionator/LICENSE +0 -22
- package/cli/node_modules/optionator/README.md +0 -238
- package/cli/node_modules/optionator/lib/help.js +0 -260
- package/cli/node_modules/optionator/lib/index.js +0 -465
- package/cli/node_modules/optionator/lib/util.js +0 -54
- package/cli/node_modules/optionator/package.json +0 -44
- package/cli/node_modules/path-is-absolute/index.js +0 -20
- package/cli/node_modules/path-is-absolute/license +0 -21
- package/cli/node_modules/path-is-absolute/package.json +0 -43
- package/cli/node_modules/path-is-absolute/readme.md +0 -59
- package/cli/node_modules/prelude-ls/CHANGELOG.md +0 -99
- package/cli/node_modules/prelude-ls/LICENSE +0 -22
- package/cli/node_modules/prelude-ls/README.md +0 -15
- package/cli/node_modules/prelude-ls/lib/Func.js +0 -65
- package/cli/node_modules/prelude-ls/lib/List.js +0 -686
- package/cli/node_modules/prelude-ls/lib/Num.js +0 -130
- package/cli/node_modules/prelude-ls/lib/Obj.js +0 -154
- package/cli/node_modules/prelude-ls/lib/Str.js +0 -92
- package/cli/node_modules/prelude-ls/lib/index.js +0 -178
- package/cli/node_modules/prelude-ls/package.json +0 -52
- package/cli/node_modules/rimraf/CHANGELOG.md +0 -65
- package/cli/node_modules/rimraf/LICENSE +0 -15
- package/cli/node_modules/rimraf/README.md +0 -101
- package/cli/node_modules/rimraf/bin.js +0 -68
- package/cli/node_modules/rimraf/package.json +0 -32
- package/cli/node_modules/rimraf/rimraf.js +0 -360
- package/cli/node_modules/source-map/CHANGELOG.md +0 -301
- package/cli/node_modules/source-map/LICENSE +0 -28
- package/cli/node_modules/source-map/README.md +0 -742
- package/cli/node_modules/source-map/dist/source-map.debug.js +0 -3234
- package/cli/node_modules/source-map/dist/source-map.js +0 -3233
- package/cli/node_modules/source-map/dist/source-map.min.js +0 -2
- package/cli/node_modules/source-map/dist/source-map.min.js.map +0 -1
- package/cli/node_modules/source-map/lib/array-set.js +0 -121
- package/cli/node_modules/source-map/lib/base64-vlq.js +0 -140
- package/cli/node_modules/source-map/lib/base64.js +0 -67
- package/cli/node_modules/source-map/lib/binary-search.js +0 -111
- package/cli/node_modules/source-map/lib/mapping-list.js +0 -79
- package/cli/node_modules/source-map/lib/quick-sort.js +0 -114
- package/cli/node_modules/source-map/lib/source-map-consumer.js +0 -1145
- package/cli/node_modules/source-map/lib/source-map-generator.js +0 -425
- package/cli/node_modules/source-map/lib/source-node.js +0 -413
- package/cli/node_modules/source-map/lib/util.js +0 -488
- package/cli/node_modules/source-map/package.json +0 -73
- package/cli/node_modules/source-map/source-map.d.ts +0 -98
- package/cli/node_modules/source-map/source-map.js +0 -8
- package/cli/node_modules/tmp/CHANGELOG.md +0 -288
- package/cli/node_modules/tmp/LICENSE +0 -21
- package/cli/node_modules/tmp/README.md +0 -365
- package/cli/node_modules/tmp/lib/tmp.js +0 -780
- package/cli/node_modules/tmp/package.json +0 -58
- package/cli/node_modules/type-check/LICENSE +0 -22
- package/cli/node_modules/type-check/README.md +0 -210
- package/cli/node_modules/type-check/lib/check.js +0 -126
- package/cli/node_modules/type-check/lib/index.js +0 -16
- package/cli/node_modules/type-check/lib/parse-type.js +0 -196
- package/cli/node_modules/type-check/package.json +0 -40
- package/cli/node_modules/word-wrap/LICENSE +0 -21
- package/cli/node_modules/word-wrap/README.md +0 -182
- package/cli/node_modules/word-wrap/index.d.ts +0 -50
- package/cli/node_modules/word-wrap/index.js +0 -46
- package/cli/node_modules/word-wrap/package.json +0 -77
- package/cli/node_modules/wrappy/LICENSE +0 -15
- package/cli/node_modules/wrappy/README.md +0 -36
- package/cli/node_modules/wrappy/package.json +0 -29
- package/cli/node_modules/wrappy/wrappy.js +0 -33
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
// Generated by LiveScript 1.6.0
|
|
2
|
-
(function(){
|
|
3
|
-
var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordWrap, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp;
|
|
4
|
-
ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines;
|
|
5
|
-
ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin;
|
|
6
|
-
wordWrap = require('word-wrap');
|
|
7
|
-
wordwrap = function(a, b){
|
|
8
|
-
var ref$, indent, width;
|
|
9
|
-
ref$ = b === undefined
|
|
10
|
-
? ['', a - 1]
|
|
11
|
-
: [repeatString$(' ', a), b - a - 1], indent = ref$[0], width = ref$[1];
|
|
12
|
-
return function(text){
|
|
13
|
-
return wordWrap(text, {
|
|
14
|
-
indent: indent,
|
|
15
|
-
width: width,
|
|
16
|
-
trim: true
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
getPreText = function(option, arg$, maxWidth){
|
|
21
|
-
var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, wrap;
|
|
22
|
-
mainName = option.option, shortNames = (ref$ = option.shortNames) != null
|
|
23
|
-
? ref$
|
|
24
|
-
: [], longNames = (ref$ = option.longNames) != null
|
|
25
|
-
? ref$
|
|
26
|
-
: [], type = option.type, description = option.description;
|
|
27
|
-
aliasSeparator = arg$.aliasSeparator, typeSeparator = arg$.typeSeparator, initialIndent = arg$.initialIndent;
|
|
28
|
-
if (option.negateName) {
|
|
29
|
-
mainName = "no-" + mainName;
|
|
30
|
-
if (longNames) {
|
|
31
|
-
longNames = map(function(it){
|
|
32
|
-
return "no-" + it;
|
|
33
|
-
}, longNames);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
names = mainName.length === 1
|
|
37
|
-
? [mainName].concat(shortNames, longNames)
|
|
38
|
-
: shortNames.concat([mainName], longNames);
|
|
39
|
-
namesString = map(nameToRaw, names).join(aliasSeparator);
|
|
40
|
-
namesStringLen = namesString.length;
|
|
41
|
-
typeSeparatorString = mainName === 'NUM' ? '::' : typeSeparator;
|
|
42
|
-
typeSeparatorStringLen = typeSeparatorString.length;
|
|
43
|
-
if (maxWidth != null && !option.boolean && initialIndent + namesStringLen + typeSeparatorStringLen + type.length > maxWidth) {
|
|
44
|
-
wrap = wordwrap(initialIndent + namesStringLen + typeSeparatorStringLen, maxWidth);
|
|
45
|
-
return namesString + "" + typeSeparatorString + wrap(type).replace(/^\s+/, '');
|
|
46
|
-
} else {
|
|
47
|
-
return namesString + "" + (option.boolean
|
|
48
|
-
? ''
|
|
49
|
-
: typeSeparatorString + "" + type);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
setHelpStyleDefaults = function(helpStyle){
|
|
53
|
-
helpStyle.aliasSeparator == null && (helpStyle.aliasSeparator = ', ');
|
|
54
|
-
helpStyle.typeSeparator == null && (helpStyle.typeSeparator = ' ');
|
|
55
|
-
helpStyle.descriptionSeparator == null && (helpStyle.descriptionSeparator = ' ');
|
|
56
|
-
helpStyle.initialIndent == null && (helpStyle.initialIndent = 2);
|
|
57
|
-
helpStyle.secondaryIndent == null && (helpStyle.secondaryIndent = 4);
|
|
58
|
-
helpStyle.maxPadFactor == null && (helpStyle.maxPadFactor = 1.5);
|
|
59
|
-
};
|
|
60
|
-
generateHelpForOption = function(getOption, arg$){
|
|
61
|
-
var stdout, helpStyle, ref$;
|
|
62
|
-
stdout = arg$.stdout, helpStyle = (ref$ = arg$.helpStyle) != null
|
|
63
|
-
? ref$
|
|
64
|
-
: {};
|
|
65
|
-
setHelpStyleDefaults(helpStyle);
|
|
66
|
-
return function(optionName){
|
|
67
|
-
var maxWidth, wrap, option, e, pre, defaultString, restPositionalString, description, fullDescription, that, preDescription, descriptionString, exampleString, examples, seperator;
|
|
68
|
-
maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
|
|
69
|
-
wrap = maxWidth ? wordwrap(maxWidth) : id;
|
|
70
|
-
try {
|
|
71
|
-
option = getOption(dasherize(optionName));
|
|
72
|
-
} catch (e$) {
|
|
73
|
-
e = e$;
|
|
74
|
-
return e.message;
|
|
75
|
-
}
|
|
76
|
-
pre = getPreText(option, helpStyle);
|
|
77
|
-
defaultString = option['default'] && !option.negateName ? "\ndefault: " + option['default'] : '';
|
|
78
|
-
restPositionalString = option.restPositional ? 'Everything after this option is considered a positional argument, even if it looks like an option.' : '';
|
|
79
|
-
description = option.longDescription || option.description && sentencize(option.description);
|
|
80
|
-
fullDescription = description && restPositionalString
|
|
81
|
-
? description + " " + restPositionalString
|
|
82
|
-
: (that = description || restPositionalString) ? that : '';
|
|
83
|
-
preDescription = 'description:';
|
|
84
|
-
descriptionString = !fullDescription
|
|
85
|
-
? ''
|
|
86
|
-
: maxWidth && fullDescription.length - 1 - preDescription.length > maxWidth
|
|
87
|
-
? "\n" + preDescription + "\n" + wrap(fullDescription)
|
|
88
|
-
: "\n" + preDescription + " " + fullDescription;
|
|
89
|
-
exampleString = (that = option.example) ? (examples = [].concat(that), examples.length > 1
|
|
90
|
-
? "\nexamples:\n" + unlines(examples)
|
|
91
|
-
: "\nexample: " + examples[0]) : '';
|
|
92
|
-
seperator = defaultString || descriptionString || exampleString ? "\n" + repeatString$('=', pre.length) : '';
|
|
93
|
-
return pre + "" + seperator + defaultString + descriptionString + exampleString;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
generateHelp = function(arg$){
|
|
97
|
-
var options, prepend, append, helpStyle, ref$, stdout, aliasSeparator, typeSeparator, descriptionSeparator, maxPadFactor, initialIndent, secondaryIndent;
|
|
98
|
-
options = arg$.options, prepend = arg$.prepend, append = arg$.append, helpStyle = (ref$ = arg$.helpStyle) != null
|
|
99
|
-
? ref$
|
|
100
|
-
: {}, stdout = arg$.stdout;
|
|
101
|
-
setHelpStyleDefaults(helpStyle);
|
|
102
|
-
aliasSeparator = helpStyle.aliasSeparator, typeSeparator = helpStyle.typeSeparator, descriptionSeparator = helpStyle.descriptionSeparator, maxPadFactor = helpStyle.maxPadFactor, initialIndent = helpStyle.initialIndent, secondaryIndent = helpStyle.secondaryIndent;
|
|
103
|
-
return function(arg$){
|
|
104
|
-
var ref$, showHidden, interpolate, maxWidth, output, out, data, optionCount, totalPreLen, preLens, i$, len$, item, that, pre, descParts, desc, preLen, sortedPreLens, maxPreLen, preLenMean, x, padAmount, descSepLen, fullWrapCount, partialWrapCount, descLen, totalLen, initialSpace, wrapAllFull, i, wrap;
|
|
105
|
-
ref$ = arg$ != null
|
|
106
|
-
? arg$
|
|
107
|
-
: {}, showHidden = ref$.showHidden, interpolate = ref$.interpolate;
|
|
108
|
-
maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
|
|
109
|
-
output = [];
|
|
110
|
-
out = function(it){
|
|
111
|
-
return output.push(it != null ? it : '');
|
|
112
|
-
};
|
|
113
|
-
if (prepend) {
|
|
114
|
-
out(interpolate ? interp(prepend, interpolate) : prepend);
|
|
115
|
-
out();
|
|
116
|
-
}
|
|
117
|
-
data = [];
|
|
118
|
-
optionCount = 0;
|
|
119
|
-
totalPreLen = 0;
|
|
120
|
-
preLens = [];
|
|
121
|
-
for (i$ = 0, len$ = (ref$ = options).length; i$ < len$; ++i$) {
|
|
122
|
-
item = ref$[i$];
|
|
123
|
-
if (showHidden || !item.hidden) {
|
|
124
|
-
if (that = item.heading) {
|
|
125
|
-
data.push({
|
|
126
|
-
type: 'heading',
|
|
127
|
-
value: that
|
|
128
|
-
});
|
|
129
|
-
} else {
|
|
130
|
-
pre = getPreText(item, helpStyle, maxWidth);
|
|
131
|
-
descParts = [];
|
|
132
|
-
if ((that = item.description) != null) {
|
|
133
|
-
descParts.push(that);
|
|
134
|
-
}
|
|
135
|
-
if (that = item['enum']) {
|
|
136
|
-
descParts.push("either: " + naturalJoin(that));
|
|
137
|
-
}
|
|
138
|
-
if (item['default'] && !item.negateName) {
|
|
139
|
-
descParts.push("default: " + item['default']);
|
|
140
|
-
}
|
|
141
|
-
desc = descParts.join(' - ');
|
|
142
|
-
data.push({
|
|
143
|
-
type: 'option',
|
|
144
|
-
pre: pre,
|
|
145
|
-
desc: desc,
|
|
146
|
-
descLen: desc.length
|
|
147
|
-
});
|
|
148
|
-
preLen = pre.length;
|
|
149
|
-
optionCount++;
|
|
150
|
-
totalPreLen += preLen;
|
|
151
|
-
preLens.push(preLen);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
sortedPreLens = sort(preLens);
|
|
156
|
-
maxPreLen = sortedPreLens[sortedPreLens.length - 1];
|
|
157
|
-
preLenMean = initialIndent + totalPreLen / optionCount;
|
|
158
|
-
x = optionCount > 2 ? min(preLenMean * maxPadFactor, maxPreLen) : maxPreLen;
|
|
159
|
-
for (i$ = sortedPreLens.length - 1; i$ >= 0; --i$) {
|
|
160
|
-
preLen = sortedPreLens[i$];
|
|
161
|
-
if (preLen <= x) {
|
|
162
|
-
padAmount = preLen;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
descSepLen = descriptionSeparator.length;
|
|
167
|
-
if (maxWidth != null) {
|
|
168
|
-
fullWrapCount = 0;
|
|
169
|
-
partialWrapCount = 0;
|
|
170
|
-
for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
|
|
171
|
-
item = data[i$];
|
|
172
|
-
if (item.type === 'option') {
|
|
173
|
-
pre = item.pre, desc = item.desc, descLen = item.descLen;
|
|
174
|
-
if (descLen === 0) {
|
|
175
|
-
item.wrap = 'none';
|
|
176
|
-
} else {
|
|
177
|
-
preLen = max(padAmount, pre.length) + initialIndent + descSepLen;
|
|
178
|
-
totalLen = preLen + descLen;
|
|
179
|
-
if (totalLen > maxWidth) {
|
|
180
|
-
if (descLen / 2.5 > maxWidth - preLen) {
|
|
181
|
-
fullWrapCount++;
|
|
182
|
-
item.wrap = 'full';
|
|
183
|
-
} else {
|
|
184
|
-
partialWrapCount++;
|
|
185
|
-
item.wrap = 'partial';
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
item.wrap = 'none';
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
initialSpace = repeatString$(' ', initialIndent);
|
|
195
|
-
wrapAllFull = optionCount > 1 && fullWrapCount + partialWrapCount * 0.5 > optionCount * 0.5;
|
|
196
|
-
for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
|
|
197
|
-
i = i$;
|
|
198
|
-
item = data[i$];
|
|
199
|
-
if (item.type === 'heading') {
|
|
200
|
-
if (i !== 0) {
|
|
201
|
-
out();
|
|
202
|
-
}
|
|
203
|
-
out(item.value + ":");
|
|
204
|
-
} else {
|
|
205
|
-
pre = item.pre, desc = item.desc, descLen = item.descLen, wrap = item.wrap;
|
|
206
|
-
if (maxWidth != null) {
|
|
207
|
-
if (wrapAllFull || wrap === 'full') {
|
|
208
|
-
wrap = wordwrap(initialIndent + secondaryIndent, maxWidth);
|
|
209
|
-
out(initialSpace + "" + pre + "\n" + wrap(desc));
|
|
210
|
-
continue;
|
|
211
|
-
} else if (wrap === 'partial') {
|
|
212
|
-
wrap = wordwrap(initialIndent + descSepLen + max(padAmount, pre.length), maxWidth);
|
|
213
|
-
out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + wrap(desc).replace(/^\s+/, ''));
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (descLen === 0) {
|
|
218
|
-
out(initialSpace + "" + pre);
|
|
219
|
-
} else {
|
|
220
|
-
out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + desc);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (append) {
|
|
225
|
-
out();
|
|
226
|
-
out(interpolate ? interp(append, interpolate) : append);
|
|
227
|
-
}
|
|
228
|
-
return unlines(output);
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
function pad(str, num){
|
|
232
|
-
var len, padAmount;
|
|
233
|
-
len = str.length;
|
|
234
|
-
padAmount = num - len;
|
|
235
|
-
return str + "" + repeatString$(' ', padAmount > 0 ? padAmount : 0);
|
|
236
|
-
}
|
|
237
|
-
function sentencize(str){
|
|
238
|
-
var first, rest, period;
|
|
239
|
-
first = str.charAt(0).toUpperCase();
|
|
240
|
-
rest = str.slice(1);
|
|
241
|
-
period = /[\.!\?]$/.test(str) ? '' : '.';
|
|
242
|
-
return first + "" + rest + period;
|
|
243
|
-
}
|
|
244
|
-
function interp(string, object){
|
|
245
|
-
return string.replace(/{{([a-zA-Z$_][a-zA-Z$_0-9]*)}}/g, function(arg$, key){
|
|
246
|
-
var ref$;
|
|
247
|
-
return (ref$ = object[key]) != null
|
|
248
|
-
? ref$
|
|
249
|
-
: "{{" + key + "}}";
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
module.exports = {
|
|
253
|
-
generateHelp: generateHelp,
|
|
254
|
-
generateHelpForOption: generateHelpForOption
|
|
255
|
-
};
|
|
256
|
-
function repeatString$(str, n){
|
|
257
|
-
for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str;
|
|
258
|
-
return r;
|
|
259
|
-
}
|
|
260
|
-
}).call(this);
|