mirror of
https://github.com/okdana/twigc.git
synced 2024-05-08 08:26:34 +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,
|
||||
'Display dependency credits (including Twig version)'
|
||||
)
|
||||
->addOption(
|
||||
'cache',
|
||||
null,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
'Enable caching to specified directory'
|
||||
)
|
||||
->addOption(
|
||||
'dir',
|
||||
'd',
|
||||
|
@ -192,6 +198,8 @@ class DefaultCommand extends Command {
|
|||
$inputData = [];
|
||||
$template = $input->getArgument('template');
|
||||
$template = $template === null ? '-' : $template;
|
||||
$cache = $input->getOption('cache');
|
||||
$cache = $cache === null ? false : $cache;
|
||||
$dirs = $template === '-' ? [] : [dirname($template)];
|
||||
$dirs = array_merge($dirs, $input->getOption('dir'));
|
||||
$temp = false;
|
||||
|
@ -346,7 +354,7 @@ class DefaultCommand extends Command {
|
|||
|
||||
try {
|
||||
$twig = new \Twig_Environment($loader, [
|
||||
'cache' => false,
|
||||
'cache' => $cache,
|
||||
'debug' => false,
|
||||
'strict_variables' => $strict,
|
||||
'autoescape' => $escape,
|
||||
|
|
Loading…
Reference in a new issue