public static function getArgs($args)
    {
        $out = [];
        $last_arg = null;

        for ($i = 1, $il = sizeof($args); $i < $il; ++$i) {
            if (preg_match('~^--(.+)~', $args[$i], $match)) {
                $parts = explode('=', $match[1]);
                $key = preg_replace('~[^a-z0-9]+~', '', $parts[0]);

                if (isset($parts[1])) {
                    $out[$key] = $parts[1];
                } else {
                    $out[$key] = true;
                }

                $last_arg = $key;
            } elseif (preg_match('~^-([a-zA-Z0-9]+)~', $args[$i], $match)) {
                $key = null;
                for ($j = 0, $jl = mb_orig_strlen($match[1]); $j < $jl; ++$j) {
                    $key = $match[1]{$j};
                    $out[$key] = true;
                }

                $last_arg = $key;
            } elseif ($last_arg !== null) {
                $out[$last_arg] = $args[$i];
            }
        }

        return $out;
    }