1017tell
Version:
1017tell CLI
54 lines (48 loc) • 932 B
JavaScript
;
const {h, Text} = require('ink');
const SelectInput = require('ink-select-input');
const opn = require('opn');
const open = url => opn(url, {wait: false});
const handleSelect = item => {
if (item.url) {
open(item.url);
}
if (item.action) {
item.action();
}
};
const items = [
{
label: 'Website',
url: 'https://1017tell.github.io'
},
{
label: 'Twitter',
url: 'https://twitter.com/1017tell'
},
{
label: 'Github',
url: 'https://github.com/1017tell'
},
{
label: 'Qiita',
url: 'https://qiita.com/fishkiller'
},
// TODO: Add separator item here when https://github.com/vadimdemedes/ink-select-input/issues/4 is done
{
label: 'Quit',
action() {
process.exit(); // eslint-disable-line unicorn/no-process-exit
}
}
];
module.exports = () => (
<div>
<br/>
<div>
<Text>(・ω・)つ</Text>
</div>
<br/>
<SelectInput items={items} onSelect={handleSelect}/>
</div>
);