-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
63 lines (57 loc) · 1.33 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
#!/usr/bin/env node
import React from 'react'
const { render, Box, Text } = require("ink");
const BigText = require("ink-big-text");
const Gradient = require("ink-gradient");
const SelectInput = require("ink-select-input").default;
const open = require("open");
const handleSelect = (item) => {
if (item.url) {
open(item.url);
}
if (item.action) {
item.action();
}
};
const createItems = (items) => {
for (const item of items) {
item.key = item.url || item.label;
}
return items;
};
const items =createItems([
{
label: '🏡 Website (Work In Progress) ',
value: 'first'
},
{
label: '📬 Email',
url: 'mailto:joshiirat@gmail.com.com'
},
{
label: '💾 Github',
url:'https://github.com/jjoshuaa'
},
{
label: "🚪 Quit",
action() {
process.exit();
}
}
]);
const Menu = () => (
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column" alignItems="center">
<Gradient name="rainbow">
<BigText text="Joshua" font="simple3d" space={false} />
</Gradient>
<Box marginY={1}>
<Text>Just another slacker bringing ideas to fruition :)</Text>
</Box>
</Box>
<Box marginLeft={1}>
<SelectInput items={items} onSelect={handleSelect} />
</Box>
</Box>
);
render(<Menu />);