Files
hiring-test-one/lib/cli-app.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

const LwsCli = require('lws/lib/cli-app')
const path = require('path')
2017-06-11 19:26:47 +01:00
class WsCli extends LwsCli {
2019-06-02 23:15:15 +01:00
execute (options) {
if (options.defaultStack) {
const list = require('./default-stack')
this.log(list)
} else {
2019-06-02 23:15:15 +01:00
return super.execute(options)
}
}
2019-06-02 23:15:15 +01:00
getDefaultOptions () {
return Object.assign(super.getDefaultOptions(), {
stack: require('./default-stack').slice(),
moduleDir: [ path.resolve(__dirname, '..'), '.' ]
})
}
partialDefinitions () {
return super.partialDefinitions().concat([
{
name: 'default-stack',
type: Boolean,
description: 'Print the default middleware stack. Any of these built-in middlewares are available to use in a custom stack.',
section: 'core'
}
])
}
usage () {
const sections = super.usage()
sections.shift()
sections.shift()
sections.pop()
sections.unshift(
{
header: 'local-web-server',
content: 'The modular web server for productive full-stack development.'
},
{
header: 'Synopsis',
content: [
'$ ws <options>',
'$ ws {underline command} <options>'
]
}
)
sections.push({
content: 'Project home: {underline https://github.com/lwsjs/local-web-server}'
})
return sections
}
showVersion () {
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
this.log(pkg.version)
2017-06-11 19:26:47 +01:00
}
}
module.exports = WsCli