text: // Generated by CoffeeScript 1.10.0
  
  /*
   * Module dependencies
   */
  var Command, which;
  
  which = require('../which');
  
  
  /*
   * Vars
   */
  
  
  /*
   * Gen cmd
   * @param config {Object} config
   * @param defaults {Object} Defaults for cmd
   * @param logger {Logger} Logger
   */
  
  Command = (function() {
    function Command(config, defaults, logger) {
      this.config = config;
      this.logger = logger;
      this.defaults = defaults;
    }
  
  
    /*
     * Generate
     * @param property {String} Property to find in config
     */
  
    Command.prototype.generate = function(property) {
      var j, len, ref, ret, tmp_ret;
      if (typeof this.config[property] === 'string') {
        if (this.config.hasOwnProperty(property)) {
          tmp_ret = this.config[property].split(' ')[0];
        }
      } else if (!this.config.hasOwnProperty(property)) {
        if (!this.config.hasOwnProperty(property) && this.defaults.hasOwnProperty(property)) {
          tmp_ret = this.defaults[property].cmd;
        }
      } else {
        tmp_ret = [];
        ref = this.config[property];
        for (j = 0, len = ref.length; j < len; j++) {
          ret = ref[j];
          tmp_ret.push(which(ret.split(' ')[0]));
        }
      }
      if (typeof tmp_ret !== 'undefined' && typeof tmp_ret === 'string') {
        return which(tmp_ret);
      }
      if (typeof tmp_ret !== 'undefined' && typeof tmp_ret !== 'string') {
        return tmp_ret;
      }
      if (typeof tmp_ret === 'undefined') {
        return null;
      }
    };
  
  
    /*
     * Get args
     * @param property {String} Property to find in config
     */
  
    Command.prototype.args = function(property) {
      var arg, i, j, k, len, len1, new_build_args, ref, tmp_build_args;
      if (this.config.hasOwnProperty(property) && typeof this.config[property] === 'string') {
        tmp_build_args = this.config[property].split(' ');
        new_build_args = [];
        for (j = 0, len = tmp_build_args.length; j < len; j++) {
          arg = tmp_build_args[j];
          if (arg !== tmp_build_args[0]) {
            new_build_args.push(arg);
          }
          if (arg === tmp_build_args[tmp_build_args.length - 1]) {
            tmp_build_args = new_build_args;
          }
        }
      } else if (this.config.hasOwnProperty(property) && typeof this.config[property] === 'object') {
        tmp_build_args = [];
        i = 0;
        while (i < this.config[property].length) {
          tmp_build_args.push([]);
          ref = this.config[property][i].split(' ');
          for (k = 0, len1 = ref.length; k < len1; k++) {
            arg = ref[k];
            if (arg !== this.config[property][i].split(' ')[0]) {
              tmp_build_args[i].push(arg);
            }
          }
          i++;
        }
      }
      if (!this.config.hasOwnProperty(property) && this.defaults.hasOwnProperty(property)) {
        tmp_build_args = this.defaults.build.args;
      }
      if (typeof tmp_build_args !== 'undefined') {
        return tmp_build_args;
      }
      if (typeof tmp_build_args === 'undefined') {
        return null;
      }
    };
  
    return Command;
  
  })();
  
  module.exports = Command;
  