-
Notifications
You must be signed in to change notification settings - Fork 305
CLI modularized, express injection allowed #576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI modularized, express injection allowed #576
Conversation
RubenVerborgh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with minor change suggestions.
bin/lib/cli.js
Outdated
|
|
||
| module.exports = function cli (server) { | ||
| program | ||
| .version(packageJson.version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nitpick) Make this one line?
bin/lib/cli.js
Outdated
| var loadInit = require('./init') | ||
| var loadStart = require('./start') | ||
|
|
||
| module.exports = function cli (server) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the function name be more descriptive? Because it doesn't return anything. Maybe startCli or something like this?
bin/lib/cli.js
Outdated
| var program = require('commander') | ||
| var packageJson = require('../../package.json') | ||
| var loadInit = require('./init') | ||
| var loadStart = require('./start') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps all of these can become const now.
|
Thanks! |
As issued in #574
This is a simple modularization of CLI so it is possible to reuse it and inject own express like this:
EDIT: renamed cli() to startCli()