-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·68 lines (63 loc) · 2 KB
/
cli.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
67
68
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const chalk = require('chalk');
const enquirer = require('enquirer');
const opn = require('opn');
const venikmansPhoneNumber = '+16173966907';
const token = 'XVYmO6ZbSVvZOUkdZolAf5xXppdcNwZz5KOL2UIbSPrOA6IY94dGy79aNH-WJbNC';
const lib = require('lib')({ token });
const sms = lib.venikman.sendSms['@dev'].main;
meow(`
Usage
$ venikman
`);
const start = async () => {
const chooseLinks = {
type : 'select',
name : 'answer',
message : chalk.green('Hi! I am venikman.'),
choices : [...['Here is my website', 'Here is my twitter', 'Here is my github', 'Send me SMS 1'].map((choise) => {
return chalk.red(choise);
}), 'Quit']
};
const answerChooseLinks = await enquirer.prompt(chooseLinks);
return answerChooseLinks;
};
start().then(async (res) => {
if (res.answer.includes('twitter')) {
opn('https://twitter.com/venik_man');
}
if (res.answer.includes('github')) {
opn('https://github.com/venikman');
}
if (res.answer.includes('website')) {
opn('https://nedbailov.com');
}
if (res.answer.includes('SMS')) {
const smsForm = {
name : 'form',
type : 'form',
message : 'Please provide your information:',
choices : [
{ name : 'name',
message : 'Yout name',
initial : 'name...' },
{ name : 'message',
message : 'Sms text',
initial : 'tell me something' }
]
};
const answer = await enquirer.prompt(smsForm);
const { name, message } = answer.form;
try {
const re = await sms(name, message, venikmansPhoneNumber, token);
console.log(re);
}
catch (error) {
console.log('this is err', error);
console.log('We got problem to send a Message.');
}
}
process.exit();
});