1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | class Help {
|
4 | constructor() {
|
5 | this.commandLineUsage = require('command-line-usage');
|
6 | this.sections = [];
|
7 | }
|
8 | main() {
|
9 | this.sections = [
|
10 | {
|
11 | header: 'XREFCLI',
|
12 | content: 'OpenEdge xref via CLI'
|
13 | },
|
14 | {
|
15 | header: 'Synopsis',
|
16 | content: 'xref <command> <options>'
|
17 | },
|
18 | {
|
19 | header: 'Commands',
|
20 | content: [
|
21 | { name: 'about', summary: 'Displays information about version/author etc ' },
|
22 | { name: 'export', summary: 'Exports source/table usage to CSV' },
|
23 | { name: 'init', summary: 'Initializes repo' },
|
24 | { name: 'list', summary: 'List tables/database used in current repo' },
|
25 | { name: 'parse', summary: 'Parses .xref files of repo' },
|
26 | { name: 'remove', summary: 'Removes a repo' },
|
27 | { name: 'repos', summary: 'List the available repos' },
|
28 | { name: 'search', summary: 'Searches a repo for field/table etc references' },
|
29 | { name: 'show', summary: 'Shows info about a source file' },
|
30 | { name: 'switch', summary: 'Switches the default repo' },
|
31 | ]
|
32 | },
|
33 | {
|
34 | header: 'Standard options',
|
35 | content: [
|
36 | '--help, -h Displays help, use xref <command> --help for help on command',
|
37 | '--name, -n Specify repo name, valid for all but about, list, repo and show'
|
38 | ]
|
39 | }
|
40 | ];
|
41 | const usage = this.commandLineUsage(this.sections);
|
42 | console.log(usage);
|
43 | }
|
44 | aboutCommand() {
|
45 | this.sections = [
|
46 | {
|
47 | header: 'XREFCLI - about command',
|
48 | content: 'Display about on XREFCLI'
|
49 | },
|
50 | {
|
51 | header: 'Synopsis',
|
52 | content: 'xref about'
|
53 | }
|
54 | ];
|
55 | const usage = this.commandLineUsage(this.sections);
|
56 | console.log(usage);
|
57 | }
|
58 | exportCommand() {
|
59 | this.sections = [
|
60 | {
|
61 | header: 'XREFCLI - export command',
|
62 | content: 'Export CSV data on source/table usage'
|
63 | },
|
64 | {
|
65 | header: 'Synopsis',
|
66 | content: 'xref export --outfile <filename> <options>'
|
67 | },
|
68 | {
|
69 | header: 'Options',
|
70 | content: [
|
71 | '--outfile, -o File for output',
|
72 | '--includeempty, -i Include source w/o db references'
|
73 | ]
|
74 | }
|
75 | ];
|
76 | const usage = this.commandLineUsage(this.sections);
|
77 | console.log(usage);
|
78 | }
|
79 | initCommand() {
|
80 | this.sections = [
|
81 | {
|
82 | header: 'XREFCLI - init command',
|
83 | content: 'Initialize repo'
|
84 | },
|
85 | {
|
86 | header: 'Synopsis',
|
87 | content: 'xref init [--name] <reponame> <options>'
|
88 | },
|
89 | {
|
90 | header: 'Options',
|
91 | content: [
|
92 | '--dir, -d Directory containing OE .xref files',
|
93 | '--srcdir, -s Directory name to be removed from all source references'
|
94 | ]
|
95 | }
|
96 | ];
|
97 | const usage = this.commandLineUsage(this.sections);
|
98 | console.log(usage);
|
99 | }
|
100 | listCommand() {
|
101 | this.sections = [
|
102 | {
|
103 | header: 'XREFCLI - list command',
|
104 | content: 'List tables/databases in repo'
|
105 | },
|
106 | {
|
107 | header: 'Synopsis',
|
108 | content: 'xref list [ [--tables] | [--dbs] ] [--json]'
|
109 | },
|
110 | {
|
111 | header: 'Options',
|
112 | content: [
|
113 | '--tables, t (default) display all tables used',
|
114 | '--dbprefix, -p Indicates if output of table names should be prefixed with database name',
|
115 | '--dbs, -d List all used databases (aliases)',
|
116 | '--json Output in JSON format, disregards the --dbprefix setting'
|
117 | ]
|
118 | }
|
119 | ];
|
120 | const usage = this.commandLineUsage(this.sections);
|
121 | console.log(usage);
|
122 | }
|
123 | parseCommand() {
|
124 | this.sections = [
|
125 | {
|
126 | header: 'XREFCLI - parse command',
|
127 | content: 'Parses .xref files from disk'
|
128 | },
|
129 | {
|
130 | header: 'Synopsis',
|
131 | content: 'xref parse [--name <reponame>]'
|
132 | }
|
133 | ];
|
134 | const usage = this.commandLineUsage(this.sections);
|
135 | console.log(usage);
|
136 | }
|
137 | removeCommand() {
|
138 | this.sections = [
|
139 | {
|
140 | header: 'XREFCLI - remove command',
|
141 | content: 'Deletes repo from disk'
|
142 | },
|
143 | {
|
144 | header: 'Synopsis',
|
145 | content: 'xref remove --name <reponame>'
|
146 | }
|
147 | ];
|
148 | const usage = this.commandLineUsage(this.sections);
|
149 | console.log(usage);
|
150 | }
|
151 | reposCommand() {
|
152 | this.sections = [
|
153 | {
|
154 | header: 'XREFCLI - repos command',
|
155 | content: 'Display repos'
|
156 | },
|
157 | {
|
158 | header: 'Synopsis',
|
159 | content: 'xref repos <options>'
|
160 | },
|
161 | {
|
162 | header: 'Options',
|
163 | content: [
|
164 | '--verbose, -v Displays verbose information about the repos',
|
165 | '--json output in JSON'
|
166 | ]
|
167 | }
|
168 | ];
|
169 | const usage = this.commandLineUsage(this.sections);
|
170 | console.log(usage);
|
171 | }
|
172 | searchCommand() {
|
173 | this.sections = [
|
174 | {
|
175 | header: 'XREFCLI - search command',
|
176 | content: 'Search for field and table references in repo'
|
177 | },
|
178 | {
|
179 | header: 'Synopsis',
|
180 | content: 'xref search [ --field <fieldname>] [--table <tablename] [--db <dbname>] ' +
|
181 | '[--create [true | false] [--update [true | false]] [--delete [true | false]'
|
182 | },
|
183 | {
|
184 | header: 'Options',
|
185 | content: [
|
186 | '--field, -f search for field references',
|
187 | '--table, -t search for table references (can be combined with --field)',
|
188 | '--db search for sources accessing <dbname>',
|
189 | '--create, -c filter on whether the --table is created (default: true)',
|
190 | '--delete, -d see --create, only for deletes',
|
191 | '--update, -u filter on whether the --field is updated (default: true)',
|
192 | '--batch, -b omit result count'
|
193 | ]
|
194 | },
|
195 | {
|
196 | header: 'Examples',
|
197 | content: [
|
198 | 'xref search --field custum --table customer --update',
|
199 | ' search for source which update customer.custnum field',
|
200 | ' ',
|
201 | 'xref search --table order --create',
|
202 | ' search for sources which create customer records'
|
203 | ]
|
204 | }
|
205 | ];
|
206 | const usage = this.commandLineUsage(this.sections);
|
207 | console.log(usage);
|
208 | }
|
209 | showCommand() {
|
210 | this.sections = [
|
211 | {
|
212 | header: 'XREFCLI - show command',
|
213 | content: 'Displays meta information about sources'
|
214 | },
|
215 | {
|
216 | header: 'Synopsis',
|
217 | content: 'xref show <sourcefile> <options>'
|
218 | },
|
219 | {
|
220 | header: 'Options',
|
221 | content: [
|
222 | '--xref, -x Show original .xref file',
|
223 | '--json Output in JSON (not for --xref)',
|
224 | '--tables, -t displays table used by <sourcefile>'
|
225 | ]
|
226 | }
|
227 | ];
|
228 | const usage = this.commandLineUsage(this.sections);
|
229 | console.log(usage);
|
230 | }
|
231 | switchCommand() {
|
232 | this.sections = [
|
233 | {
|
234 | header: 'XREFCLI - switch command',
|
235 | content: 'Set default repo'
|
236 | },
|
237 | {
|
238 | header: 'Synopsis',
|
239 | content: 'xref switch [ [--name] <reponame> ]'
|
240 | },
|
241 | {
|
242 | header: 'Options',
|
243 | content: [
|
244 | 'Without options the name of the current repo is returned.'
|
245 | ]
|
246 | }
|
247 | ];
|
248 | const usage = this.commandLineUsage(this.sections);
|
249 | console.log(usage);
|
250 | }
|
251 | }
|
252 | exports.Help = Help;
|
253 |
|
\ | No newline at end of file |