-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.js
66 lines (60 loc) · 1.31 KB
/
example.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
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
'use strict';
const inquirer = require('inquirer');
const chalkPipe = require('chalk-pipe');
inquirer.registerPrompt('chalk-pipe', require('.'));
const promptList = [
{
type: 'chalk-pipe',
name: 'text',
message: 'Text color',
default: '#cccccc'
}, {
type: 'chalk-pipe',
name: 'name',
message: 'Name color',
default: 'green'
}, {
type: 'chalk-pipe',
name: 'at',
message: 'ATs color',
default: 'cyan'
}, {
type: 'chalk-pipe',
name: 'link',
message: 'Link color',
default: 'cyan.underline'
}, {
type: 'chalk-pipe',
name: 'tag',
message: 'Tag color',
default: 'orange.bold'
}, {
type: 'chalk-pipe',
name: 'timeago',
message: 'Timeago color',
default: 'dim.green.italic'
}
];
inquirer.prompt(promptList).then(res => {
const {
text,
name,
at,
link,
tag,
timeago
} = res;
const textStyle = chalkPipe(text);
const nameStyle = chalkPipe(name);
const atStyle = chalkPipe(at);
const linkStyle = chalkPipe(link);
const tagStyle = chalkPipe(tag);
const timeagoStyle = chalkPipe(timeago);
console.log('');
console.log(textStyle('Hi Lito'));
console.log(nameStyle('LitoMore'));
console.log(atStyle('@LitoMore'));
console.log(linkStyle('https://github.com/LitoMore/chalk-pipe'));
console.log(tagStyle('#inquirer-chalk-pipe#'));
console.log(timeagoStyle('(just now)'));
});