-
Notifications
You must be signed in to change notification settings - Fork 2
/
cli.js
executable file
·47 lines (42 loc) · 1.03 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
#!/usr/bin/env node
'use strict';
// const meow = require('meow');
const { AutoComplete } = require('enquirer');
const fs = require('fs');
const createNativefierApp = require('.');
const YAML = require('yaml');
const apps = YAML.parse(fs.readFileSync('./apps.yaml', 'utf8'));
/*const cli = meow(`
Usage
$ nativefier-catalog [input]
Options
--foo Lorem ipsum [Default: false]
Examples
$ nativefier-catalog
unicorns & rainbows
$ nativefier-catalog ponies
ponies & rainbows
`, {
flags: {
foo: {
type: 'boolean'
}
}
});*/
var appsList = [];
Object.keys(apps).forEach(element => {
appsList.push({ value: element, name: apps[element].name })
});
// appsList.value = Object.keys(apps);
// appsList.name = apps[Object.keys(apps)].name;
const prompt = new AutoComplete({
name: 'app',
message: 'What app do you want to create',
limit: 10,
initial: 0,
choices: appsList
});
prompt.run()
.then(answer => createNativefierApp(answer))
.catch(console.error);
// console.log(nativefierCatalog(cli.input[0] || 'unicorns'));