function parse_arguments(&$argv)
{
    // Default options
    $defaults = array('i' => 'localhost', 'p' => '8000', "mime-file" => "/etc/mime.types", "wp-root" => ".", "wp-version" => "latest", "show-errors" => 'E_ALL', "show-assets" => false, "show-hooks" => '', "show-everything" => false, "wordpresses" => $_SERVER['HOME'] . "/.cache/whippet/wordpresses", "cb-cache" => $_SERVER['HOME'] . "/.cache/whippet/callback-cache", "multisite" => false);
    // Are there some options in a config file? Check them in order.
    if (file_exists("/etc/whippetrc")) {
        $defaults = array_merge($defaults, parse_ini_file("/etc/whippetrc"));
    }
    if (!empty($_SERVER['HOME']) && file_exists($_SERVER['HOME'] . "/.whippetrc")) {
        $defaults = array_merge($defaults, parse_ini_file($_SERVER['HOME'] . "/.whippetrc"));
    }
    $optparser = new OptionParser();
    $optparser->addRule('h|help');
    $optparser->addRule('i::');
    $optparser->addRule('p::');
    $optparser->addRule('siteurl::');
    $optparser->addRule('q');
    $optparser->addRule('multisite');
    $optparser->addRule('mime-file::');
    $optparser->addRule('no-sql');
    $optparser->addRule('no-templates');
    $optparser->addRule('no-params');
    $optparser->addRule('no-scripts');
    $optparser->addRule('show-assets');
    $optparser->addRule('show-wp-errors');
    $optparser->addRule('show-wp-queries');
    $optparser->addRule('show-wp-hooks');
    $optparser->addRule('show-errors::');
    $optparser->addRule('show-everything');
    $optparser->addRule('wp-version::');
    $optparser->addRule('show-hooks::');
    $optparser->addRule('wordpresses::');
    try {
        $argv = $optparser->parse();
    } catch (Exception $e) {
        echo Colours::fg('red') . "Error: " . Colours::fg("white") . $e->getMessage() . "\n\n";
        usage();
        exit(0);
    }
    $arguments = $optparser->getAllOptions();
    if (!isset($arguments->siteurl)) {
        $i = isset($arguments['i']) ? $arguments['i'] : $defaults['i'];
        $p = isset($arguments['p']) ? $arguments['p'] : $defaults['p'];
        if ($p == 80) {
            $defaults['siteurl'] = "http://{$i}/";
        } else {
            $defaults['siteurl'] = "http://{$i}:{$p}/";
        }
    }
    return array_merge($defaults, $arguments);
}