diff --git a/lib/index.js b/lib/index.js index cad7627..cc69725 100644 --- a/lib/index.js +++ b/lib/index.js @@ -451,6 +451,37 @@ Flightplan.prototype.availableTargets = function() { return Object.keys(this._targets); }; +/** + * Convenience method to allow easier access to runtime options + * + * ```javascript + * plan.options(); // get all options + * plan.options('myOption'); // get one specific option + * ``` + * + * @method options(key) + */ +Flightplan.prototype.options = function(key) { + if(typeof key === 'undefined') { + return this.runtime.options; + } + return this.runtime.options && this.runtime.options[key]; +}; + +/** + * Convenience method to allow easier access to runtime hosts + * + * ```javascript + * plan.hosts(); + * plan.hosts(0); + * ``` + * + * @method hosts([index]) + */ +Flightplan.prototype.hosts = function(index) { + return typeof index === 'number' ? this.runtime.hosts[index] : this.runtime.hosts; +}; + Flightplan.prototype.availableTasks = function() { return this._flights.reduce(function(result, f) { f.tasks.forEach(function(task) {