Implementing sethaurus' suggestion for better temp variable names -- getting rid of the numbers.

This commit is contained in:
Jeremy Ashkenas
2010-02-16 18:00:40 -05:00
parent e4bb6c91e7
commit db6bc0ba02
8 changed files with 256 additions and 256 deletions

View File

@@ -14,14 +14,14 @@
};
// Parse the argument array, calling defined callbacks, returning the remaining non-option arguments.
op.prototype.parse = function parse(args) {
var _1, _2, arg, callback, is_option, results, rule, value;
var _a, _b, arg, callback, is_option, results, rule, value;
results = [];
args = args.concat([]);
while (((arg = args.shift()))) {
is_option = false;
_1 = this.rules;
for (_2 = 0; _2 < _1.length; _2++) {
rule = _1[_2];
_a = this.rules;
for (_b = 0; _b < _a.length; _b++) {
rule = _a[_b];
if (rule.letter === arg || rule.flag === arg) {
callback = this.actions[rule.name];
value = rule.argument && args.shift();
@@ -40,13 +40,13 @@
};
// Return the help text for this OptionParser, for --help and such.
op.prototype.help = function help() {
var _1, _2, _3, _4, has_shorts, lines, longest, rule, text;
var _a, _b, _c, _d, has_shorts, lines, longest, rule, text;
longest = 0;
has_shorts = false;
lines = [this.banner, '', this.options_title];
_1 = this.rules;
for (_2 = 0; _2 < _1.length; _2++) {
rule = _1[_2];
_a = this.rules;
for (_b = 0; _b < _a.length; _b++) {
rule = _a[_b];
if (rule.letter) {
has_shorts = true;
}
@@ -54,9 +54,9 @@
longest = rule.flag.length;
}
}
_3 = this.rules;
for (_4 = 0; _4 < _3.length; _4++) {
rule = _3[_4];
_c = this.rules;
for (_d = 0; _d < _c.length; _d++) {
rule = _c[_d];
has_shorts ? (text = rule.letter ? spaces(2) + rule.letter + ', ' : spaces(6)) : null;
text += spaces(longest, rule.flag) + spaces(3);
text += rule.description;
@@ -72,18 +72,18 @@
// Build rules from a list of valid switch tuples in the form:
// [letter-flag, long-flag, help], or [long-flag, help].
build_rules = function build_rules(rules) {
var _1, _2, _3, tuple;
_1 = []; _2 = rules;
for (_3 = 0; _3 < _2.length; _3++) {
tuple = _2[_3];
_1.push((function() {
var _a, _b, _c, tuple;
_a = []; _b = rules;
for (_c = 0; _c < _b.length; _c++) {
tuple = _b[_c];
_a.push((function() {
if (tuple.length < 3) {
tuple.unshift(null);
}
return build_rule.apply(this, tuple);
}).call(this));
}
return _1;
return _a;
};
// Build a rule from a short-letter-flag, long-form-flag, and help text.
build_rule = function build_rule(letter, flag, description) {