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 | 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
63
63
63
1
1
1
60
60
60
60
1
1
1
1
| var __extends = this.__extends || function (d, b) {
for (var p in b) Eif (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var $ = require("../utils/optionsParser");
var parserModule = require("../utils/parserData");
var common = require("../utils/init");
var GraphModule = require("../../common/graph");
var selectors = {
lineNumber: {
name: 'line number',
description: 'action to print if line numbers on the output',
options: {
noprint: {
name: 'do not print',
option: null,
description: 'do not print line numbers',
default: true
},
allLines: {
name: 'print all lines',
option: 'n',
longOption: 'number',
description: 'print line numbers on all lines'
},
nonEmpty: {
name: 'print non-empty lines',
option: 'b',
longOption: 'number-nonblank',
description: 'print line numbers on non empty lines'
}
}
}
};
var flags = {
tabs: {
name: "show tabs",
option: 'T',
longOption: 'show-tabs',
description: "print TAB characters like ^I",
active: false
},
ends: {
name: "show ends",
option: 'E',
longOption: 'show-ends',
description: "print $ after each line",
active: false
},
nonPrint: {
name: "show non-printing",
option: 'v',
longOption: 'show-nonprinting',
description: "use ^ and M- notation, except for LFD and TAB",
active: false
},
sblanks: {
name: "squeeze blank",
option: 's',
longOption: 'squeeze-blank',
description: "suppress repeated empty output lines",
active: false
}
};
var config = {
selectors: selectors,
flags: flags
};
var bzipData = new parserModule.ParserData(config);
var optionsParser = $.optionParserFromConfig(config);
var shortOptions = optionsParser.shortOptions;
shortOptions['A'] = $.switchOn(flags.nonPrint, flags.tabs, flags.ends);
shortOptions['n'] = $.selectIfUnselected(selectors.lineNumber, selectors.lineNumber.options.allLines, selectors.lineNumber.options.nonEmpty);
var longOptions = optionsParser.shortOptions;
longOptions['show-all'] = shortOptions['A'];
longOptions['number'] = shortOptions['n'];
var CatComponent = (function (_super) {
__extends(CatComponent, _super);
function CatComponent() {
_super.apply(this, arguments);
this.exec = "cat";
this.files = [];
}
return CatComponent;
})(GraphModule.CommandComponent);
exports.CatComponent = CatComponent;
function defaultComponentData() {
var graph = new CatComponent();
graph.selectors = bzipData.componentSelectors;
graph.flags = bzipData.componentFlags;
return graph;
}
;
exports.parseCommand = common.commonParseCommand(optionsParser, defaultComponentData);
exports.parseComponent = common.commonParseComponent(bzipData.flagOptions, bzipData.selectorOptions);
exports.VisualSelectorOptions = bzipData.visualSelectorOptions;
exports.componentClass = CatComponent;
|