Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Arg#apply and Opt#apply

  • Loading branch information...
commit 63b5dea703b934d9fff1892fb8634f1081bc8120 1 parent 274e2a2
Drew CoderPuppy authored
Showing with 54 additions and 2 deletions.
  1. +17 −1 lib/arg.js
  2. +17 −1 lib/opt.js
  3. +10 −0 src/arg.coffee
  4. +10 −0 src/opt.coffee
18 lib/arg.js
View
@@ -1,5 +1,6 @@
// Generated by CoffeeScript 1.4.0
-var Arg, Cmd, Color, Opt;
+var Arg, Cmd, Color, Opt,
+ __slice = [].slice;
Color = require('./color').Color;
@@ -160,6 +161,21 @@ exports.Arg = Arg = (function() {
Arg.prototype.end = Cmd.prototype.end;
+ /**
+ Apply function with arguments in context of arg instance.
+ @param {Function} fn
+ @param {Array} args
+ @returns {COA.Arg} this instance (for chainability)
+ */
+
+
+ Arg.prototype.apply = function() {
+ var args, fn;
+ fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ fn.apply(this, args);
+ return this;
+ };
+
return Arg;
})();
18 lib/opt.js
View
@@ -1,5 +1,6 @@
// Generated by CoffeeScript 1.4.0
-var Cmd, Color, Opt, Q, fs;
+var Cmd, Color, Opt, Q, fs,
+ __slice = [].slice;
fs = require('fs');
@@ -323,6 +324,21 @@ exports.Opt = Opt = (function() {
Opt.prototype.end = Cmd.prototype.end;
+ /**
+ Apply function with arguments in context of option instance.
+ @param {Function} fn
+ @param {Array} args
+ @returns {COA.Opt} this instance (for chainability)
+ */
+
+
+ Opt.prototype.apply = function() {
+ var args, fn;
+ fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ fn.apply(this, args);
+ return this;
+ };
+
return Opt;
})();
10 src/arg.coffee
View
@@ -120,3 +120,13 @@ exports.Arg = class Arg
@returns {COA.Cmd} parent command
###
end: Cmd::end
+
+ ###*
+ Apply function with arguments in context of arg instance.
+ @param {Function} fn
+ @param {Array} args
+ @returns {COA.Arg} this instance (for chainability)
+ ###
+ apply: (fn, args...) ->
+ fn.apply this, args
+ @
10 src/opt.coffee
View
@@ -233,3 +233,13 @@ exports.Opt = class Opt
@returns {COA.Cmd} parent command
###
end: Cmd::end
+
+ ###*
+ Apply function with arguments in context of option instance.
+ @param {Function} fn
+ @param {Array} args
+ @returns {COA.Opt} this instance (for chainability)
+ ###
+ apply: (fn, args...) ->
+ fn.apply this, args
+ @
Please sign in to comment.
Something went wrong with that request. Please try again.