-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (35 loc) · 1.16 KB
/
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
import { select, Separator } from "@inquirer/prompts";
import sql from "./utils/data.js";
import chalk from "chalk";
// The main menu
const choices = [
new Separator(chalk.grey("-- View --")),
{ value: "View all departments" },
{ value: "View all roles" },
{ value: "View all employees" },
{ value: "View employee's by manager" },
{ value: "View employee's by department" },
{ value: "View total budget of department (Sum of salaries)" },
new Separator(chalk.grey("-- Add --")),
{ value: "Add a department" },
{ value: "Add a role" },
{ value: "Add an employee" },
new Separator(chalk.grey("-- Update --")),
{ value: "Update an employee role" },
{ value: "Update an employee's manager" },
{ value: "Remove a department, role, or employee from the database" },
{ name: chalk.italic.red("Quit"), value: "quit" },
];
// Initialize and handle quit
export default async function init() {
const answer = await select({
message: `${chalk.bold.blue("Welcome!")} \n ${chalk.bold.blue(
"What would you like to do?"
)}`,
choices: choices,
pageSize: choices.length,
});
if (answer === "quit") process.exit();
sql(answer);
}
init();