-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (25 loc) · 710 Bytes
/
index.js
File metadata and controls
27 lines (25 loc) · 710 Bytes
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
const chalk = require('chalk');
const screen = require('./utils/screen');
const { addTask, deleteTask } = require('./lib');
const { newTask, showTasksEditor, listTasks } = require('./ui');
module.exports = async (input, flags) => {
if (flags.task) {
const { task, group } = flags;
addTask(task, group);
process.exit();
} else if (flags.new) {
const { task, group } = await newTask();
addTask(task, group);
process.exit();
} else if (flags.edit) {
screen.init();
showTasksEditor(flags.edit);
} else if (flags.delete) {
if (!deleteTask(flags.delete))
console.log(chalk.grey('\n:( no task with that index exists.\n'));
process.exit();
} else {
screen.init();
listTasks();
}
};