// Generated by IcedCoffeeScript 1.7.1-c
(function() {
  var Base, add_option_dict, add_option_kv, copy, rmkey;

  Base = require('argparse').ArgumentParser;

  rmkey = require('../util').rmkey;

  copy = function(d1) {
    var d2, k, v;
    d2 = {};
    for (k in d1) {
      v = d1[k];
      d2[k] = v;
    }
    return d2;
  };

  exports.add_option_dict = add_option_dict = function(ap, d) {
    var k, v, _results;
    _results = [];
    for (k in d) {
      v = d[k];
      _results.push(add_option_kv(ap, k, v));
    }
    return _results;
  };

  exports.add_option_kv = add_option_kv = function(ap, k, d) {
    var a, as, n, names;
    d = copy(d);
    names = [k];
    if ((a = rmkey(d, 'alias'))) {
      names.push(a);
    }
    if ((as = rmkey(d, 'aliases'))) {
      names = names.concat(as);
    }
    names = (function() {
      var _i, _len, _results;
      _results = [];
      for (_i = 0, _len = names.length; _i < _len; _i++) {
        n = names[_i];
        _results.push("-" + (n.length > 1 ? '-' : '') + n);
      }
      return _results;
    })();
    return ap.addArgument(names, d);
  };

}).call(this);
