-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.ts
55 lines (48 loc) · 1.01 KB
/
cli.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
#!/usr/bin/env node
"use strict";
import meow from "meow";
import dotfileToTS from "./index";
const cli = meow(
`
Usage
$ dotfile-types [<file>] [<outDir>]
Options
--namespace=<namespace_name> interfaces will be wrapped in a namespace
--prefix=<prefix_string> override the I prefix on interface names
--rootName=<rootname_string> overide the RootObject name of the top-level interface
Examples
$ dotfile-types US_EN.properties
$ dotfile-types .env types
$ dotfile-types --namespace API
$ dotfile-types --prefix "" --rootName "Product"
`,
{
flags: {
outDir: {
type: "string",
default: ""
},
namespace: {
type: "string"
},
prefix: {
type: "string"
},
rootName: {
type: "string"
}
}
}
);
const { input, flags: options, showHelp } = cli;
/**
* Runs the dotfileToTS command
*/
function main() {
if (input.length === 0) {
showHelp();
return;
}
dotfileToTS(input[0], input[1], options);
}
main();