mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
display the usage message when called without arguments
This commit is contained in:
parent
02ac3edebf
commit
7d348b5eae
2 changed files with 9 additions and 3 deletions
|
@ -10,6 +10,9 @@
|
|||
// The CommandLine handles all of the functionality of the `coffee` utility.
|
||||
exports.run = function run() {
|
||||
this.parse_options();
|
||||
if (!(this.sources.length)) {
|
||||
this.usage();
|
||||
}
|
||||
this.compile_scripts();
|
||||
return this;
|
||||
};
|
||||
|
@ -113,6 +116,7 @@
|
|||
var oparser, opts, paths;
|
||||
opts = (this.options = {});
|
||||
oparser = (this.option_parser = new optparse.OptionParser(SWITCHES));
|
||||
oparser.banner = BANNER;
|
||||
oparser.add = oparser['on'];
|
||||
oparser.add('interactive', function() {
|
||||
return opts.interactive = true;
|
||||
|
|
|
@ -31,6 +31,7 @@ WATCH_INTERVAL: 0.5
|
|||
# The CommandLine handles all of the functionality of the `coffee` utility.
|
||||
exports.run: ->
|
||||
@parse_options()
|
||||
@usage() unless @sources.length
|
||||
@compile_scripts()
|
||||
this
|
||||
|
||||
|
@ -101,6 +102,7 @@ exports.lint: (js) ->
|
|||
exports.parse_options: ->
|
||||
opts: @options: {}
|
||||
oparser: @option_parser: new optparse.OptionParser SWITCHES
|
||||
oparser.banner: BANNER
|
||||
oparser.add: oparser['on']
|
||||
|
||||
oparser.add 'interactive', -> opts.interactive: true
|
||||
|
|
Loading…
Add table
Reference in a new issue