/
help.ts
71 lines (66 loc) · 1.79 KB
/
help.ts
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
import Table from "cli-table";
import { CLIArg, CLIArgAlias } from "./options";
import Logger from "./logger";
export const writeHelpTable = () => {
const table = new Table({
head: ["Command", "Alias", "Description"],
style: {
head: new Array(3).fill("cyan"),
},
});
let rows = [
[CLIArg.FILE_NAME, CLIArgAlias.FILE_NAME, "File name to be used"],
[CLIArg.DIR_PATH, "", "Path to the location where to generate files"],
[
CLIArg.TEMPLATE_NAME,
CLIArgAlias.TEMPLATE_NAME,
"Name of the template to use",
],
[CLIArg.TEMPLATE_PATH, "", "Path to the specific template folder"],
[
CLIArg.SHOULD_REPLACE_FILE_NAME,
"",
"Should or not CLI replace a file name",
],
[
CLIArg.FILE_NAME_TEXT_TO_BE_REPLACED,
"",
"Wich part of the file name should be replaced",
],
[
CLIArg.SHOULD_REPLACE_FILE_CONTENT,
"",
"Should or not CLI replace a file content",
],
[
CLIArg.TEXT_TO_BE_REPLACED,
"",
"Text to be replaced separated by a search and replace separator",
],
[
CLIArg.REPLACE_TEXT_WITH,
"",
"Text to be used for search and replace separated by a separator",
],
[
CLIArg.SEARCH_AND_REPLACE_SEPARATOR,
"",
"Custom separator for search and replace",
],
[CLIArg.LIST, CLIArgAlias.LIST, "List all templates"],
[CLIArg.LIST_DETAILED, "", "List all templates with additional info"],
[
CLIArg.VERSION,
CLIArgAlias.VERSION,
"Show the current version of the package",
],
[CLIArg.DEBUG, "", "Show additional logs"],
];
rows = rows.map(([command, alias, ...rest]) => [
`--${command}`,
!!alias ? `-${alias}` : "",
...rest,
]);
table.push(...rows);
Logger.log(table.toString());
};