Esempio n. 1
0
 /**
  * Display a warning in the CLI and end with a newline
  *
  * @param string $message
  * @param string $label
  */
 static function warning($message, $label = 'Warning')
 {
     if (WP_CLI_SILENT) {
         return;
     }
     \cli\line('%C' . $label . ': %n' . $message);
 }
Esempio n. 2
0
 /**
  * Display a success in the CLI and end with a newline
  *
  * @param string $message
  * @param string $label
  */
 static function success($message, $label = 'Success')
 {
     if (WP_CLI_QUIET) {
         return;
     }
     \cli\line('%G' . $label . ': %n' . $message);
 }
Esempio n. 3
0
function removeFromTrash($cont_id)
{
    $apiResult = cvCli('contact', 'create', array('id' => $cont_id, 'is_deleted' => FALSE));
    if ($apiResult->is_error) {
        var_dump($apiResult);
    } else {
        cli\line("Contact ID#{$cont_id} removed from Trash.");
    }
}
Esempio n. 4
0
 /**
  * @param array $args
  * @param array $flags
  */
 public function call($args, $flags)
 {
     $client = Server::loadClient($args);
     $user = $client->me();
     if ($user) {
         Users::displayUser($user);
     } else {
         \cli\line('%rCould not authenticate...%n');
     }
 }
Esempio n. 5
0
 /**
  * @param array $args
  * @param array $flags
  */
 public function call($args, $flags)
 {
     $client = Server::loadClient($args);
     if (empty($args['-p'])) {
         \cli\err('Parameter -p is required (path to request)');
     }
     $response = $client->request(isset($args['-X']) ? $args['-X'] : 'GET', trim($args['-p'], '/'), isset($args['-d']) ? parse_str($args['-d']) : array(), true);
     \cli\line('%_Status:%n ' . $response->status);
     if (in_array('--v', $flags)) {
         \cli\line('%_Headers:%n ');
         foreach ($response->headers as $name => $val) {
             \cli\line("   {$name}: {$val} ");
         }
     }
     \cli\line('%_Body:%n ' . PHP_EOL . str_replace('stdClass ', '', print_r($response->body, true)));
     //var_dump($response);
 }
Esempio n. 6
0
 public function handleRequest($type, $path)
 {
     $request = new Buzz\Message\Request($type, $path, $this->_host);
     $response = new Buzz\Message\Response();
     $client = new Buzz\Client\FileGetContents();
     $client->send($request, $response);
     // Display headers
     foreach ($response->getHeaders() as $i => $header) {
         if ($i == 0) {
             \cli\line('%G{:header}%n', compact('header'));
             continue;
         }
         list($key, $value) = explode(': ', $header, 2);
         \cli\line('%W{:key}%n: {:value}', compact('key', 'value'));
     }
     \cli\line("\n");
     print $response->getContent() . "\n";
     switch ($type) {
     }
 }
Esempio n. 7
0
 /**
  * Echoes a VHost skeleton with correct path inserted.
  *
  * @param string $installPath The install path to insert.
  *
  * @author Benjamin Carl <*****@*****.**>
  * @return void
  * @access protected
  * @static
  */
 protected static function showVhostExample($installPath)
 {
     \cli\line();
     \cli\line('You could use this skeleton (example and not production ready!) for your vhost:');
     \cli\line();
     \cli\line(\cli\Colors::colorize('%y<VirtualHost *:80>'));
     \cli\line('    ServerName www.example.com:80');
     \cli\line('    ServerAlias example.com *.example.com');
     \cli\line('    ServerAdmin webmaster@example.com');
     \cli\line('    DocumentRoot "' . $installPath . DIRECTORY_SEPARATOR . 'web"');
     \cli\line('    <Directory "' . $installPath . DIRECTORY_SEPARATOR . 'web">');
     \cli\line('        Options Indexes FollowSymLinks Includes ExecCGI');
     \cli\line('        AllowOverride All');
     \cli\line('        Order allow,deny');
     \cli\line('        Allow from all');
     \cli\line('        DirectoryIndex app.php index.php index.html index.htm');
     \cli\line('    </Directory>');
     \cli\line('</VirtualHost>');
 }
 protected function select_acf_field()
 {
     $field_groups = get_posts(array('numberposts' => -1, 'post_type' => 'acf', 'sort_column' => 'menu_order', 'order' => 'ASC'));
     $choices = array();
     $choices[''] = 'all';
     foreach ($field_groups as $group) {
         $choices[$group->ID] = $group->post_title;
     }
     while (true) {
         $choice = \cli\menu($choices, null, 'Pick a fieldgroup to export');
         \cli\line();
         return $choice;
         break;
     }
 }
Esempio n. 9
0
 /**
  * Adds a new line with page break
  */
 public function outputPageBreak()
 {
     \cli\line('');
     \cli\line('========================================================');
 }
Esempio n. 10
0
 /**
  * Load client either specified in given args or default client
  * @param array $args
  * @return \Rocker\REST\ClientInterface
  */
 public static function loadClient($args)
 {
     $self = new self();
     $serverList = $self->loadStoredServerInfo();
     if (empty($args['-s'])) {
         if (empty($serverList['__default']) || empty($serverList[$serverList['__default']])) {
             \cli\line('%rNo server given as argument nor set as default%n');
             return null;
         }
         $serverName = $serverList['__default'];
     } else {
         $serverName = $args['-s'];
     }
     if (empty($serverList[$serverName])) {
         \cli\line('%rServer "' . $serverName . '" does not exist%n');
         return null;
     }
     $client = new Client($serverList[$serverName]['address']);
     $client->setAuthString($serverList[$serverName]['auth']);
     return $client;
 }
Esempio n. 11
0
 /**
  * Output the table to `STDOUT` using `cli\line()`.
  *
  * @see cli\Table::renderRow()
  */
 public function display()
 {
     $borderStr = '+';
     foreach ($this->_headers as $column => $header) {
         $borderStr .= '-' . str_repeat('-', $this->_width[$column]) . '-+';
     }
     \cli\line($borderStr);
     \cli\line($this->renderRow($this->_headers));
     \cli\line($borderStr);
     foreach ($this->_rows as $row) {
         \cli\line($this->renderRow($row));
     }
     \cli\line($borderStr);
 }
Esempio n. 12
0
 /**
  * List all user's capabilities.
  *
  * ## OPTIONS
  *
  * <user>
  * : User ID, user email, or login.
  *
  * ## EXAMPLES
  *
  *     wp user list-caps admin
  *     wp user list-caps 21
  *
  * @subcommand list-caps
  */
 public function list_caps($args, $assoc_args)
 {
     $user = $this->fetcher->get_check($args[0]);
     if ($user) {
         $user->get_role_caps();
         $user_caps_list = $user->allcaps;
         $cap_table_titles = array('capability', 'status');
         foreach ($user_caps_list as $cap => $active) {
             if ($active) {
                 \cli\line($cap);
             }
         }
     }
 }
Esempio n. 13
0
    \cli\err('Could not retieve Atlasian download feed.');
    exit(1);
}
$current_a = json_decode(trim((string) $feed_current, 'downloads()'), true);
$current_a = array_filter($current_a, function ($version) {
    if (substr($version['zipUrl'], -7) !== '.tar.gz') {
        return false;
    }
    return $version;
});
$versions = [];
foreach ($current_a as $version) {
    $versions[$version['version']] = $version;
}
uksort($versions, 'version_compare');
\cli\line(count($versions) . ' Versions Found:');
$tree = new \cli\Tree();
$tree->setData($versions);
$tree->setRenderer(new \cli\tree\Ascii());
$tree->display();
// Prepare for build
$data = end($versions);
$m = new Mustache_Engine();
// Format release date
$time = strtotime($data['released']);
$data['released'] = date('F j, Y', $time);
// Generate Dockerfile
$dockerfile = $m->render(file_get_contents('Dockerfile.tmpl'), $data);
file_put_contents('Dockerfile', $dockerfile);
$readme = $m->render(file_get_contents('README.md.tmpl'), $data);
file_put_contents('README.md', $readme);
Esempio n. 14
0
<?php

require_once 'common.php';
\cli\out("  \\cli\\out sends output to STDOUT\n");
\cli\out("  It does not automatically append a new line\n");
\cli\out("  It does accept any number of %s which are then %s to %s for formatting\n", 'arguments', 'passed', 'sprintf');
\cli\out("  Alternatively, {:a} can use an {:b} as the second argument.\n\n", array('a' => 'you', 'b' => 'array'));
\cli\err('  \\cli\\err sends output to STDERR');
\cli\err('  It does automatically append a new line');
\cli\err('  It does accept any number of %s which are then %s to %s for formatting', 'arguments', 'passed', 'sprintf');
\cli\err("  Alternatively, {:a} can use an {:b} as the second argument.\n", array('a' => 'you', 'b' => 'array'));
\cli\line('  \\cli\\line forwards to \\cli\\out for output');
\cli\line('  It does automatically append a new line');
\cli\line('  It does accept any number of %s which are then %s to %s for formatting', 'arguments', 'passed', 'sprintf');
\cli\line("  Alternatively, {:a} can use an {:b} as the second argument.\n", array('a' => 'you', 'b' => 'array'));
Esempio n. 15
0
 /**
  * Output the table to `STDOUT` using `cli\line()`.
  *
  * If STDOUT is a pipe or redirected to a file, should output simple
  * tab-separated text. Otherwise, renders table with ASCII table borders
  *
  * @uses cli\Shell::isPiped() Determine what format to output
  *
  * @see cli\Table::renderRow()
  */
 public function display()
 {
     $this->_renderer->setWidths($this->_width);
     $this->_renderer->setAlign($this->_align);
     $border = $this->_renderer->border();
     if (isset($border)) {
         \cli\line($border);
     }
     \cli\line($this->_renderer->row($this->_headers));
     if (isset($border)) {
         \cli\line($border);
     }
     foreach ($this->_rows as $row) {
         \cli\line($this->_renderer->row($row));
     }
     if (isset($border)) {
         \cli\line($border);
     }
 }
Esempio n. 16
0
 /**
  * Display a warning in the CLI and end with a newline
  *
  * @param string $message
  * @param string $label
  */
 static function warning($message, $label = 'Warning')
 {
     \cli\line('%C' . $label . ': %n' . $message);
 }
Esempio n. 17
0
<?php

/*
 * Copyright 2015 Jack Sleight <http://jacksleight.com/>
 * This source file is subject to the MIT license that is bundled with this package in the file LICENCE.md. 
 */
use Chalk\App as Chalk;
use Chalk\Repository;
if (cli\choose("Are you sure", 'yn', 'n') == 'n') {
    exit;
}
cli\line('Clearing cache..');
$app->cache->deleteAll();
try {
    cli\line('Clearing index..');
    $conn = $app->em->getConnection();
    $table = Chalk::info('Chalk\\Core\\Index')->name;
    $conn->exec("TRUNCATE TABLE {$table}");
    $metas = $app->em->getMetadataFactory()->getAllMetadata();
    foreach ($metas as $meta) {
        if (!is_a($meta->name, 'Chalk\\Core\\Behaviour\\Searchable', true) || $meta->name != $meta->rootEntityName) {
            continue;
        }
        $limit = 100;
        $page = 0;
        do {
            $page++;
            $entities = $app->em($meta->name)->all(['limit' => $limit, 'page' => $page], [], Repository::FETCH_ALL_PAGED);
            if ($page == 1) {
                $total = $entities->count();
                $pages = ceil($total / $limit);
 private function choice($choices, $question = false)
 {
     if (!$question) {
         $question = __('Choose something', 'acf-wpcli');
     }
     while (true) {
         $choice = \cli\menu($choices, null, $question);
         \cli\line();
         break;
     }
     return $choice;
 }
Esempio n. 19
0
            break;
        case 'out_line':
            \cli\line('  \\cli\\line forwards to \\cli\\out for output');
            \cli\line('  It does automatically append a new line');
            \cli\line('  It does accept any number of %s which are then %s to %s for formatting', 'arguments', 'passed', 'sprintf');
            \cli\line('  Alternatively, {:a} can use an {:b} as the second argument.', array('a' => 'you', 'b' => 'array'));
            break;
        case 'notify_dots':
            test_notify(new \cli\notify\Dots('  \\cli\\notify\\Dots cycles through a set number of dots'));
            test_notify(new \cli\notify\Dots('  You can disable the delay if ticks take longer than a few milliseconds', 5, 0), 10, 100000);
            \cli\line('    All progress meters and notifiers extend \\cli\\Notify which handles the interval above.');
            break;
        case 'notify_spinner':
            test_notify(new \cli\notify\Spinner('  \\cli\\notify\\Spinner cycles through a set of characters to emulate a spinner'));
            break;
        case 'progress_bar':
            test_notify(new \cli\progress\Bar('  \\cli\\progress\\Bar displays a progress bar', 1000000));
            test_notify(new \cli\progress\Bar('  It sizes itself dynamically', 1000000));
            break;
        case 'table':
            $table = new \cli\Table();
            $table->setHeaders($headers);
            $table->setRows($data);
            $table->display();
            break;
        case 'colors':
            \cli\line('  %C%5All output is run through %Y%6\\cli\\Colors::colorize%C%5 before display%n');
            break;
    }
    \cli\line();
}
Esempio n. 20
0
    $app->em->persist($user);
    $app->em->flush();
    cli\line('Creating default page..');
    $page = new \Chalk\Core\Page();
    $page->fromArray(['name' => 'Site']);
    $app->em->persist($page);
    $app->em->flush();
    cli\line('Creating default structures..');
    $struct1 = new \Chalk\Core\Structure();
    $struct1->fromArray(['name' => 'Primary']);
    $struct1->root->content = $page;
    $struct1->root->name = 'Home';
    $app->em->persist($struct1);
    $app->em->flush();
    $struct2 = new \Chalk\Core\Structure();
    $struct2->fromArray(['name' => 'Secondary']);
    $app->em->persist($struct2);
    $app->em->flush();
    cli\line('Creating default domain..');
    $domain = new \Chalk\Core\Domain();
    $domain->fromArray(['name' => 'example.com']);
    $domain->structures->add($struct1);
    $domain->structures->add($struct2);
    $app->em->persist($domain);
    $app->em->flush();
    $app->em->commit();
} catch (Exception $e) {
    $app->em->rollback();
    cli\err('Error: ' . $e->getMessage());
}
require_once $cmds['proxy-generate']->name();
Esempio n. 21
0
 function _($str)
 {
     \cli\line($str);
 }
Esempio n. 22
0
 public function testTables()
 {
     $this->resetStreams();
     $suffix = \cli\Shell::isPiped() ? "_piped" : "";
     $this->assertTrue(is_numeric($columns = \cli\Shell::columns()));
     $headers = array('First Name', 'Last Name', 'City', 'State');
     $data = array(array('Maryam', 'Elliott', 'Elizabeth City', 'SD'), array('Jerry', 'Washington', 'Bessemer', 'ME'), array('Allegra', 'Hopkins', 'Altoona', 'ME'), array('Audrey', 'Oneil', 'Dalton', 'SK'));
     $table = new \cli\Table();
     $table->setRenderer(new \cli\table\Ascii());
     $table->setHeaders($headers);
     $table->setRows($data);
     $table->display();
     $output = $this->getStreams();
     $this->assertEquals("", $output['errors']);
     $this->assertEquals(file_get_contents("test/output/table_1"), $output['contents']);
     $this->resetStreams();
     $table->sort(1);
     $table->display();
     $output = $this->getStreams();
     $this->assertEquals("", $output['errors']);
     $this->assertEquals(file_get_contents("test/output/table_2"), $output['contents']);
     $this->resetStreams();
     foreach ($data as $k => $v) {
         $data[$k] = array_combine(array("name", "surname", "city", "state"), $v);
     }
     $renderer = new \cli\table\Ascii();
     $renderer->setCharacters(array("corner" => "x", "line" => "=", "border" => "!"));
     $table = new \cli\Table($data);
     $table->setRenderer($renderer);
     $table->sort("surname");
     $table->display();
     $output = $this->getStreams();
     $this->assertEquals("", $output['errors']);
     $this->assertEquals(file_get_contents("test/output/table_3"), $output['contents']);
     $this->assertEquals("", \cli\Colors::color("reset"));
     $this->assertEquals("foo\tbar", \cli\table\Tabular::row(array("foo", "bar")));
     $this->assertNull(\cli\table\Tabular::border());
     // test output
     $this->resetStreams();
     \cli\out("  \\cli\\out sends output to STDOUT\n");
     \cli\out("  It does not automatically append a new line\n");
     \cli\out("  It does accept any number of %s which are then %s to %s for formatting\n", 'arguments', 'passed', 'sprintf');
     \cli\out("  Alternatively, {:a} can use an {:b} as the second argument.\n\n", array('a' => 'you', 'b' => 'array'));
     \cli\err('  \\cli\\err sends output to STDERR');
     \cli\err('  It does automatically append a new line');
     \cli\err('  It does accept any number of %s which are then %s to %s for formatting', 'arguments', 'passed', 'sprintf');
     \cli\err("  Alternatively, {:a} can use an {:b} as the second argument.\n", array('a' => 'you', 'b' => 'array'));
     \cli\line('  \\cli\\line forwards to \\cli\\out for output');
     \cli\line('  It does automatically append a new line');
     \cli\line('  It does accept any number of %s which are then %s to %s for formatting', 'arguments', 'passed', 'sprintf');
     \cli\line("  Alternatively, {:a} can use an {:b} as the second argument.\n", array('a' => 'you', 'b' => 'array'));
     $output = $this->getStreams();
     $this->assertEquals(file_get_contents("test/output/out_errors"), $output['errors']);
     $this->assertEquals(file_get_contents("test/output/out_contents"), $output['contents']);
     $string = "";
     $string .= \cli\render('  \\cli\\err sends output to STDERR' . "\n");
     $string .= \cli\render('  It does automatically append a new line' . "\n");
     $string .= \cli\render('  It does accept any number of %s which are then %s to %s for formatting' . "\n", 'arguments', 'passed', 'sprintf');
     $string .= \cli\render("  Alternatively, {:a} can use an {:b} as the second argument.\n\n", array('a' => 'you', 'b' => 'array'));
     $this->assertEquals(file_get_contents("test/output/out_errors"), $string);
     $this->resetStreams();
     $in = tmpfile();
     fputs($in, "quit\n");
     fseek($in, 0);
     \cli\Streams::setStream("in", $in);
     $line = \cli\prompt("prompt", false, "# ");
     $output = $this->getStreams();
     $this->assertEquals("quit", $line);
     $this->assertEquals("", $output['errors']);
     $this->assertEquals("prompt# ", $output['contents']);
     fseek($in, 0);
     $this->assertEquals("quit", \cli\input());
     fclose($in);
 }
Esempio n. 23
0
 /**
  * Display a message in the CLI and end with a newline
  *
  * @param string $message
  */
 static function line($message = '', $params = array())
 {
     if (!empty($params)) {
         $message = vsprintf($message, $params);
     }
     echo \cli\line($message);
 }
Esempio n. 24
0
 /**
  * Show Doozr banner.
  *
  * @author Benjamin Carl <*****@*****.**>
  * @return void
  * @access protected
  * @static
  */
 protected static function showDoozrBanner()
 {
     \cli\line('%N%n%y');
     \cli\line('  _____     ______     ______     ______     ______');
     \cli\line(' /\\  __-.  /\\  __ \\   /\\  __ \\   /\\___  \\   /\\  == \\');
     \cli\line(' \\ \\ \\/\\ \\ \\ \\ \\/\\ \\  \\ \\ \\/\\ \\  \\/_/  /__  \\ \\  __<');
     \cli\line('  \\ \\____-  \\ \\_____\\  \\ \\_____\\   /\\_____\\  \\ \\_\\ \\_\\');
     \cli\line('   \\/____/   \\/_____/   \\/_____/   \\/_____/   \\/_/ /_/');
     \cli\line('%N%n');
 }
Esempio n. 25
0
<?php

require_once 'common.php';
\cli\line('  %C%5All output is run through %Y%6\\cli\\Colors::colorize%C%5 before display%n');
Esempio n. 26
0
/*
 * Copyright 2015 Jack Sleight <http://jacksleight.com/>
 * This source file is subject to the MIT license that is bundled with this package in the file LICENCE.md. 
 */
if (cli\choose("Are you sure", 'yn', 'n') == 'n') {
    exit;
}
require_once $cmds['cache-clear']->name();
$schema = new \Doctrine\ORM\Tools\SchemaTool($app->em->value());
cli\line('Calculating changes..');
$stmts = $schema->getUpdateSchemaSql($app->em->getMetadataFactory()->getAllMetadata(), false);
if (!count($stmts)) {
    cli\line("Nothing to update");
    exit;
}
cli\line("The following statements will be executed:\n  " . implode("\n  ", $stmts));
if (cli\choose("Execute these statements", 'yn', 'n') == 'n') {
    exit;
}
$app->em->beginTransaction();
try {
    $bar = new cli\progress\Bar("Executing statements..", count($stmts), 1);
    $conn = $app->em->getConnection();
    foreach ($stmts as $stmt) {
        $conn->exec($stmt);
        $bar->tick();
    }
    $bar->finish();
    $app->em->commit();
} catch (Exception $e) {
    $app->em->rollback();
Esempio n. 27
0
    try {
        $queue->createTable($config['table_name']);
        cli\line("%gTable '{$config['table_name']}' has been created in {$settings['region']}%n");
    } catch (Exception $e) {
        cli\err("%rUnable to create table in DynamoDB: " . $e->getMessage() . "%n");
        exit(1);
    }
    exit(0);
}
//------------------------------------
// If we're performing a table cleanup
if ($arguments['cleanup']) {
    try {
        $ttl = $arguments['ttl'] && is_numeric($arguments['ttl']) ? (int) $arguments['ttl'] : 0;
        $deletedJobs = $queue->cleanupTable($ttl);
        cli\line("%g{$deletedJobs} jobs tidied up from '{$config['table_name']}'%n");
    } catch (Exception $e) {
        cli\err("%rUnable to cleanup table: " . $e->getMessage() . "%n");
        exit(1);
    }
    exit(0);
}
//------------------------------------
// Validate the table (and connection)
try {
    $valid = $queue->isTableValid();
    if (is_array($valid)) {
        $logger->alert("Errors were found when validating the table is setup correctly", $valid);
        exit(1);
    }
} catch (Exception $e) {
Esempio n. 28
0
 /**
  * Shows the outro message after install succeeded to inform about management console.
  *
  * @author Benjamin Carl <*****@*****.**>
  * @return void
  * @access protected
  * @static
  */
 protected static function showOutro($projectRoot = 'n.a.')
 {
     \cli\line();
     \cli\line(\cli\Colors::colorize('%nEnjoy your installation of %y' . self::PROJECT_NAME_SHORT . ' (document root: "' . $projectRoot . '")%n'));
     \cli\line();
 }
Esempio n. 29
0
 /**
  * List all user's capabilities.
  *
  * ## OPTIONS
  *
  * <user>
  * : User ID, user email, or login.
  *
  * ## EXAMPLES
  *
  *     wp user list-caps admin
  *     wp user list-caps 21
  *
  * @subcommand list-caps
  */
 public function list_caps($args, $assoc_args)
 {
     $user = $this->fetcher->get_check($args[0]);
     if ($user) {
         $user->get_role_caps();
         $user_caps_list = $user->allcaps;
         foreach ($user_caps_list as $cap => $active) {
             if ($active) {
                 \cli\line($cap);
             }
         }
     }
 }
Esempio n. 30
0
    cli\line('Creating sample data..');
    $html = '
		<h1>{0}</h1>
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo dignissimos explicabo eius autem dolorum, ducimus, possimus sed sint! Perspiciatis praesentium at eum ea molestiae. Aut voluptas alias magni, amet sit.</p>
		<p>Cumque, earum culpa maxime ex facere eaque, natus mollitia rem quia nam in. Voluptas reiciendis eum a porro ut provident, totam veniam, itaque autem rem deserunt vel in, molestiae nam!</p>
		<p>Unde doloribus vero quos labore, qui consequatur perspiciatis sit accusantium aut explicabo doloremque error ducimus ipsa nemo exercitationem, omnis dolores earum non tenetur a! Dignissimos delectus cumque nemo voluptate nihil!</p>
		<p>Iusto a cum esse provident maiores incidunt doloribus voluptate, animi quibusdam molestias. Eveniet ad nemo eius excepturi quisquam repellat officiis distinctio, adipisci cum saepe porro dicta, iure deserunt mollitia nostrum!</p>
	';
    $names = array('name', 'lobortis augue scelerisque mollis.', 'aliquet', 'adipiscing elit.', 'dictum ultricies', 'vel, mauris.', 'accumsan laoreet', 'enim nisl elementum', 'tellus faucibus', 'Donec', 'eleifend. Cras sed', 'ac tellus. Suspendisse', 'egestas. Sed pharetra,', 'magnis', 'mi pede, nonummy', 'per', 'vulputate eu, odio. Phasellus', 'nec ante.', 'Donec dignissim', 'Vivamus euismod urna. Nullam', 'nisl. Quisque fringilla', 'nec,', 'ante. Vivamus non lorem');
    shuffle($names);
    $structs = $app->em('Chalk\\Core\\Structure')->all(['sort' => 'id']);
    $struct = $structs[0];
    $nodes = [$struct->root];
    foreach ($names as $name) {
        $name = ucwords($name);
        $page = new \Chalk\Core\Page();
        $page->fromArray(['name' => $name, 'blocks' => [['name' => 'primary', 'value' => str_replace('{0}', $name, $html)]]]);
        $app->em->persist($page);
        $node = new \Chalk\Core\Structure\Node();
        $node->content = $page;
        $node->parent = rand(0, 10) ? $nodes[array_rand($nodes)] : $nodes[0];
        $app->em->persist($node);
        $nodes[] = $node;
    }
    $app->em->flush();
    cli\line('Comitting to database..');
    $app->em->commit();
} catch (Exception $e) {
    $app->em->rollback();
    cli\err('Error: ' . $e->getMessage());
}