Skip to content
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模块的cli声明方式 #183

Closed
errorrik opened this issue Mar 21, 2014 · 7 comments
Closed

精简cli模块的cli声明方式 #183

errorrik opened this issue Mar 21, 2014 · 7 comments
Milestone

Comments

@errorrik
Copy link
Contributor

按照之前讨论的结论,对cli模块进行分离和抽取。但是,现在的cli模块声明有些冗余。

比如build,现在声明方式如下:

var cli = {};
cli.description = '...';
cli.main = function () {};
exports.cli = cli;

但是抽取后,cli模块应该就只包含command运行相关信息,无需暴露其他api。所以,建议抽取成下面这样,少一级,不用以cli property暴露:

exports.cli = '...';
exports.cli = function () {};
@errorrik errorrik added this to the 1.0.0 milestone Mar 21, 2014
@leeight
Copy link
Member

leeight commented Mar 21, 2014

description应该保留吧

@otakustay
Copy link
Member

做成对象以后还能加help之类的东西呢

在 2014年3月21日,12:42,leeight notifications@github.com 写道:

description应该保留吧


Reply to this email directly or view it on GitHub.

@errorrik
Copy link
Contributor Author

我写错了,是这样

exports.description = '...';
exports.main = function () {};
//.....

@leeight
Copy link
Member

leeight commented Mar 21, 2014

那还是exports.cli = cli吧,这样子require之后只需要判断是不是有cli对象就知道是不是一个cmd模块了。

@errorrik
Copy link
Contributor Author

难道cli目录下的js有可能不是command模块?

@leeight
Copy link
Member

leeight commented Mar 21, 2014

这个比较难说,以后的edpx-foo说不定是谁提供的

@errorrik
Copy link
Contributor Author

好吧,那就维持老样子吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants