From b808c530cc81ae70ea8436250de06b2e20c7ffea Mon Sep 17 00:00:00 2001 From: Tristan Date: Sun, 3 Dec 2023 13:57:07 +0100 Subject: [PATCH] Make it possible to skip examples --- src/ExecuteDay.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ExecuteDay.php b/src/ExecuteDay.php index e94953d..5f52ab8 100644 --- a/src/ExecuteDay.php +++ b/src/ExecuteDay.php @@ -22,7 +22,8 @@ final class ExecuteDay extends Command ->setName('day') ->setDescription('Run day') ->addArgument('day', InputArgument::REQUIRED, 'The day number') - ->addArgument('year', InputArgument::OPTIONAL, 'The year', date('y')); + ->addArgument('year', InputArgument::OPTIONAL, 'The year', date('y')) + ->addOption('skip-example', 's', null, 'Skip the example data'); } #[\Override] @@ -50,7 +51,7 @@ final class ExecuteDay extends Command // Solve the examples if available. $resultPart1Example = 'n/a'; $resultPart2Example = 'n/a'; - if ($class->hasExampleData()) { + if ($class->hasExampleData() && !$input->getOption('skip-example')) { ['part1' => $resultPart1Example, 'part2' => $resultPart2Example] = $class->results(useExampleData: true); }