<?php # This file is _only_ used to setup and run these command line examples. include __DIR__ . '/composer.php'; $cli = new League\CLImate\CLImate(); $defaultArgs = ['debug' => ['prefix' => 'd', 'longPrefix' => 'debug', 'description' => 'Enable Debug Mode: Output HTTP traffic to STDOUT', 'defaultValue' => false, 'noValue' => true], 'verbose' => ['prefix' => 'v', 'longPrefix' => 'verbose', 'description' => 'Enable Verbose Mode: Output response bodies (JSON) to STDOUT', 'defaultValue' => false, 'noValue' => true], 'file' => ['prefix' => 'e', 'longPrefix' => 'edgerc', 'description' => 'Path to .edgerc file', 'defaultValue' => null], 'section' => ['prefix' => 's', 'longPrefix' => 'section', 'description' => '.edgerc section to use', 'defaultValue' => 'default'], 'help' => ['prefix' => 'h', 'longPrefix' => 'help', 'description' => 'Show this help', 'defaultValue' => false, 'noValue' => true]]; $arguments = isset($arguments) ? array_merge($defaultArgs, $arguments) : $defaultArgs; try { $cli->arguments->add($arguments); $cli->arguments->parse($_SERVER['argv']); if ($cli->arguments->get('help')) { $cli->usage(); exit; } if ($cli->arguments->get('debug')) { \Akamai\Open\EdgeGrid\Client::setDebug(true); } if ($cli->arguments->get('verbose')) { \Akamai\Open\EdgeGrid\Client::setVerbose(true); } $configFile = $cli->arguments->get('config'); $configSection = $cli->arguments->get('section'); if (!extension_loaded('curl')) { $cli->whisper("PHP curl extension not enabled. Output from --debug may be less useful."); } } catch (\Exception $e) { $cli->error($e->getMessage() . "\n"); $cli->usage(); exit; }
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) { $file[SECTION][$key] = $value; } $out = ''; foreach ($file as $section => $config) { $out .= "[{$section}]\n";
<?php require_once 'vendor/autoload.php'; $climate = new League\CLImate\CLImate(); $climate->arguments->add(['percent' => ['prefix' => 'p', 'longPrefix' => 'percent', 'description' => 'Percent level for creation image.', 'defaultValue' => '0']]); // Clearing all output dir before launch script. exec('rm -rf ./images/output'); if (!is_dir("./images")) { $climate->error("Tags don't exist."); $climate->Green("Please create it using: casperjs compare.js --tag=[TAG] --domain=[DOMAIN]"); return; } else { do { $tags = scandir("./images"); unset($tags[0]); unset($tags[1]); $input = $climate->checkboxes('Please choose 2 tags for comparing:', $tags); $response = $input->prompt(); if (count($response) != 2) { $climate->error('You need to choice 2 options.'); } } while (count($response) != 2); } $tag_one = $response[0]; $tag_two = $response[1]; if (!is_dir("./images/{$tag_one}")) { $climate->error('Tag one is required.'); $climate->usage(); return; } if (!is_dir("./images/{$tag_two}")) {