if an option is an array, eat all non-hyphenated arguments following it... YUM! e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
501827
function eatArray (i, key, args) {
    var start = i + 1
    var argsToSet = []
    var multipleArrayFlag = i > 0
    for (var ii = i + 1; ii < args.length; ii++) {
      if (/^-/.test(args[ii]) && !negative.test(args[ii])) {
        if (ii === start) {
          setArg(key, defaultForType('array'))
        }
        multipleArrayFlag = true
        break
      }
      i = ii
      argsToSet.push(args[ii])
    }
    if (multipleArrayFlag) {
      setArg(key, argsToSet.map(function (arg) {
        return processValue(key, arg)
      }))
    } else {
      argsToSet.forEach(function (arg) {
        setArg(key, arg)
      })
    }

    return i
  }
904910
def escape_keywords(arr):
    """"""
    for i in arr:
        i = i if i not in kwlist else i + '_'
        i = i if '-' not in i else i.replace('-', '_')
        yield i
980247
function getArgs(args) {

  if (args.length === 0) {
    return [];
  }

  if (Array.isArray(args[0])) {
    return args[0];
  }

  return Array.prototype.slice.call(args);
}
1130334
function optionsToShellArgs(options) {
    var result = [];

    for (var key in options) {
        var value = options[key];

        if (value === null || value === undefined || value === false) {
            continue;
        }

        if (is.bool(value)) {
            result.push(key);
        } else {
            result.push(key + '=' + escapeShellArg(value));
        }
    }

    return result.join(' ');
}
353731
function normalizeArgs(args, exclude) {
    var result = [];
    args = splitArgs(args || []);
    exclude = splitArgs(exclude || []);
    args.slice(0).forEach(function (arg) {
        var val;
        if (arg && arg.indexOf && ~arg.indexOf('=')) {
            var kv = arg.split('=');
            arg = kv[0];
            val = kv[1];
        }
        if (/^-{1}[a-z]+/i.test(arg)) {
            var spread = arg.slice(1).split('').map(function (a) { return '-' + a; });
            if (val)
                spread.push(val);
            result = result.concat(spread);
        }
        else {
            result.push(arg);
            if (val)
                result.push(val);
        }
    });
    return filterArgs(result, exclude);
}
1227700
def _format_array(x, fmt):
    # type: (Any, str) -> str
    
    value_repr = ", ".join(fmt.format(v) for v in x)
    return "[{}]".format(value_repr)
1240024
function OptNArgs($a)
    {
        $cnt = $dashdash = 0;
        if (is_array($a) && count($a)) {
            for ($i = 1; $i < count($a); $i++) {
                if ($dashdash
                    || !($a[$i][0] == '-' || $a[$i][0] == '+' || strchr($a[$i], '='))
                ) {
                    $cnt++;
                }
                if ($a[$i] == "--") {
                    $dashdash = 1;
                }
            }
        }
        return $cnt;
    }
500170
def FnNot(value)
      if value.is_a?(Array)
        Fn.new('Not', value)
      else
        Fn.new('Not', [value])
      end
    end
130110
def _format_arg_list(args, variadic=False):
    
    def sugar(s):
        """Shorten strings that are too long for decency."""
        s = s.replace("{", "{{").replace("}", "}}")
        if len(s) > 50:
            return s[:20] + " ... " + s[-20:]
        else:
            return s

    def arg_to_str(arg):
        """Convert argument to a string."""
        if isinstance(arg, str):
            return sugar(repr(arg))
        elif arg is Parameter.empty:
            return '\u2014'
        else:
            return sugar(str(arg))

    if not args:
        if variadic:
            return "(\u2026)"
        else:
            return "()"

    return "(" + ", ".join(map(arg_to_str, args)) + ")"
914265
def arg_strings(parsed_args, name=None):
    """"""
    name = name or 'arg_strings'
    value = getattr(parsed_args, name, [])
    if isinstance(value, str):
        return [value]
    try:
        return [v for v in value if isinstance(v, str)]
    except TypeError:
        return []
1256165
def _parse_multi_options(options, split_token=','):
    
    """
    if options:
        return [o.strip() for o in options.split(split_token) if o.strip()]
    else:
        return options
796961
def fix_repeating_arguments(self):
        """"""
        either = [list(child.children) for child in transform(self).children]
        for case in either:
            for e in [child for child in case if case.count(child) > 1]:
                if type(e) is Argument or type(e) is Option and e.argcount:
                    if e.value is None:
                        e.value = []
                    elif type(e.value) is not list:
                        e.value = e.value.split()
                if type(e) is Command or type(e) is Option and e.argcount == 0:
                    e.value = 0
        return self
992319
function (op, args) {
            var likeOps = ["~", "~*", "LIKE", "ILIKE"];
            var notLikeOps = ["!~", "!~*", "NOT LIKE", "NOT ILIKE"];
            var regExpOps = ["~", "!~", "~*", "!~*"];
            var binaryOps = ["~", "!~", "LIKE", "NOT LIKE"];
            if (likeOps.indexOf(op) !== -1 || notLikeOps.indexOf(op) !== -1) {
                return format("(%s%s %s%s %s)", this.literal(args[0]), notLikeOps.indexOf(op) !== -1 ? " NOT" : "",
                    regExpOps.indexOf(op) !== -1 ? "REGEXP" : "LIKE", binaryOps.indexOf(op) !== -1 ? " BINARY" : "",
                    this.literal(args[1]));
            } else if (op === "||") {
                if (args.length > 1) {
                    return format("CONCAT(%s)", args.map(this.literal, this).join(", "));
                } else {
                    return this.literal(args[0]);
                }
            } else if (op === "B~") {
                return format("CAST(~%s AS SIGNED INTEGER)", this.literal(args[0]));
            } else {
                return this._super(arguments);
            }
        }
927054
function filterArgs(args, exclude) {
    args = splitArgs(args || []);
    exclude = splitArgs(exclude || []);
    var clone = args.slice(0);
    return clone.filter(function (arg, i) {
        if (!~exclude.indexOf(arg))
            return true;
        var next = clone[i + 1];
        if (_flagExp.test(arg) && next && !_flagExp.test(next))
            clone.splice(i + 1, 1);
        return false;
    });
}
270008
def process_options(opts):
    """"""
    # Convert match and exclude args into pattern lists
    match = opts.get("match")
    if match and type(match) is str:
        opts["match"] = [pat.strip() for pat in match.split(",")]
    elif match:
        assert type(match) is list
    else:
        opts["match"] = []

    exclude = opts.get("exclude")
    if exclude and type(exclude) is str:
        opts["exclude"] = [pat.strip() for pat in exclude.split(",")]
    elif exclude:
        assert type(exclude) is list
    else:
        # opts["exclude"] = DEFAULT_OMIT
        opts["exclude"] = []
928386
def format_args(options):
    
    args = list()

    for key, value in options.items():
        # convert foo_bar key into --foo-bar option
        key = key.replace('_', '-')

        if value is True:
            # key: True
            # --key
            args.append('--{key}'.format(key=key))
        elif is_sequence(value):
            # key: ['foo', 'bar']
            # --key=foo,bar
            values = [str(val) for val in value]
            args.append('--{key}={values}'.format(
                key=key, values=','.join(values)))
        else:
            # key: 'foo'
            # --key=foo
            args.append('--{key}={value}'.format(key=key, value=value))

    return args
471847
function ( arg ) {
		var result;

		if ( !arg ) {
			return;
		}

		arg = string.trim( arg );

		if ( arg.indexOf( "," ) === -1 ) {
			result = utility.dom( arg );
		}
		else {
			result = [];

			array.each( string.explode( arg ), function ( query ) {
				var obj = utility.dom( query );

				if ( obj instanceof Array ) {
					result = result.concat( obj );
				}
				else if ( obj ) {
					result.push( obj );
				}
			});
		}

		return result;
	}