UNPKG

1.63 kBJavaScriptView Raw
1#!/usr/bin/env node
2'use strict';
3const meow = require('meow');
4const inquirer = require('inquirer');
5const clipboardy = require('clipboardy');
6const config = require('./config.js');
7const template = require('./template.js');
8const replace = require('./replace.js');
9
10// eslint-disable-next-line no-unused-vars
11const cli = meow(`
12 Usage
13 standup-boy
14
15 Examples
16 $ standup-boy
17 ? What did I accomplish yesterday? Something!
18 ? What will I do today? Something Else!
19 ? What obstacles are impeding my progress? Any info I need or want to share? Not much...
20
21 :triumph: **\`What did I accomplish yesterday\`**
22 Something!
23 :scream_cat: **\`What will I do today\`**
24 Something Else!
25 :cry: **\`What obstacles are impeding my progress? Any info I need or want to share?\`**
26 Not much...
27 Copied the result to the clipboard!
28`, {
29 inferType: true,
30 flags: {
31 path: {
32 type: 'boolean',
33 alias: 'p'
34 }
35 }
36}
37);
38
39if (cli.flags.path) {
40 console.log(config.path);
41 process.exit(0);
42}
43
44const questions = [
45 {
46 type: 'input',
47 name: 'yesterday',
48 message: 'What did I accomplish yesterday?'
49 },
50 {
51 type: 'input',
52 name: 'today',
53 message: 'What will I do today?'
54 },
55 {
56 type: 'input',
57 name: 'obstacles',
58 message: 'What obstacles are impeding my progress? Any info I need or want to share?'
59 }
60];
61
62inquirer.prompt(questions).then(answers => {
63 let res =
64`${template.yesterday()}
65
66${answers.yesterday}
67
68${template.today()}
69
70${answers.today}
71
72${template.obstacles()}
73
74${answers.obstacles}`;
75
76 res = replace(res);
77 console.log(res);
78 clipboardy.writeSync(res);
79 console.log('Copied the result to the clipboard!');
80});