Beispiel #1
0
 /**
  * Get the multiple command cli example.
  *
  * @return Cli
  */
 public function getCommandCli()
 {
     // Define a cli with commands.
     $cli = Cli::create()->command('push')->description('Push data to a remote server.')->opt('force:f', 'Force an overwrite.', false, 'boolean')->opt('set-upstream:u', 'Add a reference to the upstream repo.', false, 'boolean')->command('pull')->description('Pull data from a remote server.')->opt('commit', 'Perform the merge and commit the result.', false, 'boolean')->command('*')->opt('verbose:v', 'Output verbose information.', false, 'boolean')->arg('repo', 'The repository to sync with.', true);
     return $cli;
 }
Beispiel #2
0
<?php

require_once 'config.php';
require_once 'vendor/autoload.php';
use TimelineAPI\Pin;
use TimelineAPI\PinLayout;
use TimelineAPI\PinLayoutType;
use TimelineAPI\PinIcon;
use TimelineAPI\PinReminder;
use TimelineAPI\Timeline;
use Garden\Cli\Cli;
define('PUSH', 'push');
define('DISPLAY', 'display');
$cli = Cli::create()->command('push')->description('Pushes pins to timeline API')->opt("testing:t", "Push pins using the sandbox key", false, 'boolean')->command('display')->description('Displays the JSON for the pins instead of pushing them to the API')->command('*')->opt('days-out:d', 'The number of days out to pull data from the GHTV API. Default is 3.', false, 'integer')->opt('num-items:i', 'The maximum number of items to pull from the GHTV API. Default is no limit.', false, 'integer');
$args = $cli->parse($argv);
$command = $args->getCommand();
$daysout = $args->getOpt('days-out', 3);
$numitems = $args->getOpt('num-items', PHP_INT_MAX);
if ($command == PUSH && true === $args->getOpt('testing', false)) {
    $key = TEST_KEY;
} else {
    $key = PROD_KEY;
}
$category_list = ["pop", "rock", "metal", "indie", "classics", "riffs", "jams", "hits", "smashes", "picks", "knockouts", "anthems", "headliners", "blockbusters"];
$d = json_decode(file_get_contents("https://www.guitarhero.com/api/papi-client/ghl/v1/channelSchedules/en/all/"));
$data = $d->data;
$programs = [];
foreach ($data as $channel => $channel_details) {
    foreach ($channel_details->programmes as $program) {
        $title = $program->title;
        $program->channel = $channel_details->title;