Skip to content

Commit fe2eea5

Browse files
committed
fix: guard against non existing files
1 parent 7f5205a commit fe2eea5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Commands/InfoCommand.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4444

4545
$llmsTxtFileFullname = \getcwd() . DIRECTORY_SEPARATOR . $llmsTxtFileToAnalyse;
4646

47+
if (\file_exists($llmsTxtFileFullname) === false) {
48+
$warning = \sprintf("Warning: The provided llms txt file %s does not exists.", basename($llmsTxtFileFullname));
49+
$outputContent = '<error>' . $warning . '</error>';
50+
$output->writeln($outputContent);
51+
52+
return Command::FAILURE;
53+
}
54+
4755
$analysedLlmsTxt = $this->llmsTxt->parse($llmsTxtFileFullname);
4856

4957
$amountOfSectionLinks = 0;

0 commit comments

Comments
 (0)