-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ts
65 lines (53 loc) · 1.49 KB
/
main.ts
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
import { intro, outro, select } from "@clack/prompts";
import { getAllThemes } from "./lib/config.ts";
import { getInstalledThemes } from "./lib/config.ts";
intro(`Welcome to the hyprtheme CLI! Need help? Run \`hyprtheme --help\``);
const action = await select({
message: "#--- Select an action: ---#",
options: [
{ value: "themeinstall", label: "Install a theme" },
{ value: "thememanage", label: "Manage installed themes" },
{
value: "import",
label: "Import a configuration",
hint: "Dangerous, overwrites existing config",
},
{
value: "backup",
label: "Manage backups",
},
],
});
switch (action) {
case "themeinstall": {
const themes: any | object[] = await getAllThemes();
if (themes.length === 0) {
outro("No themes found to install!");
Deno.exit();
}
const options: { value: string; label: string; hint?: string }[] = [];
for (const theme of themes) {
options.push({
value: theme.name,
label: theme.name,
hint: `${theme.description}, by ${theme.author}`,
});
}
const themeSelected = await select({
message: "Select a theme to install:",
options: options,
});
const themeConfig = themes.find(
(themeSelected: object) => themeSelected === themeSelected
);
console.log(themeConfig.name);
break;
}
case "thememanage":
break;
case "import":
break;
case "backup":
break;
}
outro(`You're all set with your new theme!`);