mirror of
https://github.com/okdana/twigc.git
synced 2024-06-11 18:32:12 +02:00
Add --cache option
This commit is contained in:
parent
36d2d6d99d
commit
d5ae7c4e73
|
@ -51,6 +51,12 @@ class DefaultCommand extends Command {
|
||||||
InputOption::VALUE_NONE,
|
InputOption::VALUE_NONE,
|
||||||
'Display dependency credits (including Twig version)'
|
'Display dependency credits (including Twig version)'
|
||||||
)
|
)
|
||||||
|
->addOption(
|
||||||
|
'cache',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'Enable caching to specified directory'
|
||||||
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'dir',
|
'dir',
|
||||||
'd',
|
'd',
|
||||||
|
@ -192,6 +198,8 @@ class DefaultCommand extends Command {
|
||||||
$inputData = [];
|
$inputData = [];
|
||||||
$template = $input->getArgument('template');
|
$template = $input->getArgument('template');
|
||||||
$template = $template === null ? '-' : $template;
|
$template = $template === null ? '-' : $template;
|
||||||
|
$cache = $input->getOption('cache');
|
||||||
|
$cache = $cache === null ? false : $cache;
|
||||||
$dirs = $template === '-' ? [] : [dirname($template)];
|
$dirs = $template === '-' ? [] : [dirname($template)];
|
||||||
$dirs = array_merge($dirs, $input->getOption('dir'));
|
$dirs = array_merge($dirs, $input->getOption('dir'));
|
||||||
$temp = false;
|
$temp = false;
|
||||||
|
@ -346,7 +354,7 @@ class DefaultCommand extends Command {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$twig = new \Twig_Environment($loader, [
|
$twig = new \Twig_Environment($loader, [
|
||||||
'cache' => false,
|
'cache' => $cache,
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
'strict_variables' => $strict,
|
'strict_variables' => $strict,
|
||||||
'autoescape' => $escape,
|
'autoescape' => $escape,
|
||||||
|
|
Loading…
Reference in a new issue