mirror of
https://github.com/okdana/twigc.git
synced 2024-05-19 22:06:35 +02:00
Application: Update for new package versions, fix formatting
This commit is contained in:
parent
c76ce18517
commit
c7f9eb7514
|
@ -13,6 +13,7 @@ use GetOpt\{Argument,GetOpt,Operand,Option};
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
use Symfony\Component\Console\Output\{ConsoleOutputInterface,OutputInterface};
|
use Symfony\Component\Console\Output\{ConsoleOutputInterface,OutputInterface};
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
|
use Twig\Extension\EscaperExtension;
|
||||||
use Twig\Loader\{ArrayLoader,FilesystemLoader};
|
use Twig\Loader\{ArrayLoader,FilesystemLoader};
|
||||||
|
|
||||||
use Dana\Twigc\ComposerHelper;
|
use Dana\Twigc\ComposerHelper;
|
||||||
|
@ -122,7 +123,7 @@ class Application {
|
||||||
$temp = false;
|
$temp = false;
|
||||||
|
|
||||||
// If we're receiving data on standard input, and we didn't get a template,
|
// If we're receiving data on standard input, and we didn't get a template,
|
||||||
// assume `-` — we'll make sure this doesn't conflict with `-j` below
|
// assume `-` — we'll make sure this doesn't conflict with `-j` below
|
||||||
if ( ! posix_isatty(\STDIN) ) {
|
if ( ! posix_isatty(\STDIN) ) {
|
||||||
$template = $template ?? '-';
|
$template = $template ?? '-';
|
||||||
}
|
}
|
||||||
|
@ -249,18 +250,18 @@ class Application {
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$twig->getExtension('Twig_Extension_Core')->setEscaper(
|
$twig->getExtension(EscaperExtension::class)->setEscaper(
|
||||||
'json',
|
'json',
|
||||||
function($twigEnv, $string, $charset) {
|
function ($twigEnv, $string, $charset) {
|
||||||
return json_encode(
|
return json_encode(
|
||||||
$string,
|
$string,
|
||||||
\JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE
|
\JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$twig->getExtension('Twig_Extension_Core')->setEscaper(
|
$twig->getExtension(EscaperExtension::class)->setEscaper(
|
||||||
'sh',
|
'sh',
|
||||||
function($twigEnv, $string, $charset) {
|
function ($twigEnv, $string, $charset) {
|
||||||
return '"' . addcslashes($string, '$`\\"') . '"';
|
return '"' . addcslashes($string, '$`\\"') . '"';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -337,9 +338,9 @@ class Application {
|
||||||
|
|
||||||
$table = new Table($output);
|
$table = new Table($output);
|
||||||
$table->setStyle('compact');
|
$table->setStyle('compact');
|
||||||
$table->getStyle()->setVerticalBorderChar('');
|
$table->getStyle()->setVerticalBorderChars('');
|
||||||
$table->getStyle()->setCellRowContentFormat('%s ');
|
$table->getStyle()->setCellRowContentFormat('%s ');
|
||||||
$table->setHeaders(['name', 'version', 'licence']);
|
$table->setHeaders(['#name', 'version', 'licence']);
|
||||||
|
|
||||||
foreach ( $packages as $package ) {
|
foreach ( $packages as $package ) {
|
||||||
$table->addRow([
|
$table->addRow([
|
||||||
|
|
Loading…
Reference in a new issue