mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
removing the vendored optparse in favor of a pure-coffeescript optparse library
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
posix = require('posix');
|
||||
path = require('path');
|
||||
coffee = require('coffee-script');
|
||||
optparse = require('./../../vendor/optparse-js/src/optparse');
|
||||
optparse = require('optparse');
|
||||
BANNER = "coffee compiles CoffeeScript source files into JavaScript.\n\nUsage:\n coffee path/to/script.coffee";
|
||||
SWITCHES = [['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-r', '--run', 'compile and run a CoffeeScript'], ['-o', '--output [DIR]', 'set the directory for compiled JavaScript'], ['-w', '--watch', 'watch scripts for changes, and recompile'], ['-p', '--print', 'print the compiled JavaScript to stdout'], ['-l', '--lint', 'pipe the compiled JavaScript through JSLint'], ['-e', '--eval', 'compile a string from the command line'], ['-t', '--tokens', 'print the tokens that the lexer produces'], ['-tr', '--tree', 'print the parse tree that Jison produces'], ['-v', '--version', 'display CoffeeScript version'], ['-h', '--help', 'display this help message']];
|
||||
WATCH_INTERVAL = 0.5;
|
||||
@@ -27,7 +27,7 @@
|
||||
};
|
||||
// The "--help" usage message.
|
||||
usage = function usage() {
|
||||
puts('\n' + option_parser.toString() + '\n');
|
||||
puts('\n' + option_parser.help() + '\n');
|
||||
return process.exit(0);
|
||||
};
|
||||
// The "--version" message.
|
||||
@@ -125,14 +125,13 @@
|
||||
opts = (options = {});
|
||||
oparser = (option_parser = new optparse.OptionParser(SWITCHES));
|
||||
oparser.banner = BANNER;
|
||||
oparser.add = oparser['on'];
|
||||
oparser.add('interactive', function() {
|
||||
return opts.interactive = true;
|
||||
});
|
||||
oparser.add('run', function() {
|
||||
return opts.run = true;
|
||||
});
|
||||
oparser.add('output', function(n, dir) {
|
||||
oparser.add('output', function(dir) {
|
||||
return opts.output = dir;
|
||||
});
|
||||
oparser.add('watch', function() {
|
||||
|
||||
Reference in New Issue
Block a user