-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
40 lines (33 loc) · 899 Bytes
/
index.js
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
#!/usr/bin/env node
'use strict';
const woofwoof = require('woofwoof');
const chalk = require('chalk');
const figlet = require('figlet');
const fs = require('fs');
const read = require('./read');
const cli = woofwoof(`
Usage
$ typelize <input>
Options
--name, -n Who should I greet
`, {
alias: {
n: 'name'
},
default: {
name: "World!"
}
});
function hello(input, flags) {
const target_path = input;
read(input, (err, ok)=>{
if(err){
console.log(chalk.red('typelize failed, report this issue at: https://github.com/opendidx/typelize/issues . Thank you so much!'))
}
if(ok){
console.log(`${chalk.green('new file ./typelize-result.json is created')}`)
console.log(figlet.textSync('typelize done!', {horizontalLayout: 'full'}));
}
})
}
hello(cli.input[0], cli.flags);