-
Notifications
You must be signed in to change notification settings - Fork 306
Expand file tree
/
Copy pathsolid.js
More file actions
67 lines (55 loc) · 1.48 KB
/
solid.js
File metadata and controls
67 lines (55 loc) · 1.48 KB
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
66
67
// #!/usr/bin/env node
// var program = require('commander')
// var packageJson = require('../package.json')
// var loadInit = require('./lib/init')
// var loadStart = require('./lib/start')
// program
// .version(packageJson.version)
// loadInit(program)
// loadStart(program)
// program.parse(process.argv)
// if (program.args.length === 0) program.help()
const init = require('./lib/init')
const start = require('./lib/start')
const options = require('./lib/options')
var yargs = require('yargs')
const argv = yargs
.usage('usage: solid <command> [options]')
.command('init', 'set up a configuration file', function (yargs) {
const argv = yargs
.usage('usage: solid create <item> [options]')
.options({
advanced: {
description: 'ask extra questions'
}
})
.help('help')
.wrap(null)
.argv
init(argv)
})
.command('start', 'run a solid server', function (yargs) {
let command = yargs
.usage('usage: solid create [options]')
options
.filter((option) => !option.hide)
.forEach((option) => {
if (option.default) delete option.default
command.option(option.name, option)
})
command
.help('help')
.wrap(null)
start(command.argv)
})
.help('help')
.wrap(null)
.argv
checkCommands(yargs, argv, 1)
function checkCommands (yargs, argv, numRequired) {
if (argv._.length < numRequired) {
yargs.showHelp()
} else {
// check for unknown command
}
}