예제 #1
0
    exit(-1);
}
echo "After authorizing your client in the {OPEN} API Administration tool,\n";
echo "export the credentials and paste the contents of the export file below,\n";
echo "followed by control-D. (You may need to enter is twice)\n";
echo ">>> ";
$inputStream = fopen('php://stdin', 'r+');
if (!($file = $cli->arguments->get('file'))) {
    $input = stream_get_contents($inputStream);
} elseif (file_exists($file) && is_readable($file)) {
    $input = file_get_contents($file);
}
$cli = new League\CLImate\CLImate();
$cli->out("");
if (file_exists(EDGERC)) {
    $cli->bold()->info("Updating Existing .edgerc File");
    $file = parse_ini_file(EDGERC, true, INI_SCANNER_RAW);
    if (isset($file[SECTION])) {
        $response = $cli->bold()->cyan()->input("Update existing section? (" . SECTION . ") [Y/n]")->prompt();
        if (strtolower($response) != 'y' && !empty($response)) {
            $cli->error("This script will now exit.");
            exit(-1);
        }
    } else {
        $cli->lightBlue("Adding new section: " . SECTION);
    }
} else {
    $cli->info("Creating new .edgerc file");
    $cli->lightBlue("Adding new section: " . SECTION);
}
foreach (parse($input) as $key => $value) {