From d5ae7c4e73aed84731825013a21e421e03289112 Mon Sep 17 00:00:00 2001 From: dana Date: Sun, 24 Jul 2016 16:22:41 -0500 Subject: [PATCH] Add --cache option --- src/Twigc/DefaultCommand.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Twigc/DefaultCommand.php b/src/Twigc/DefaultCommand.php index d6ae5b6..e3abc7d 100644 --- a/src/Twigc/DefaultCommand.php +++ b/src/Twigc/DefaultCommand.php @@ -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,