Skip to content

Commit 83b5909

Browse files
committed
wip
1 parent a758b95 commit 83b5909

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/router/src/Static/StaticGenerateCommand.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ public function __invoke(
6262
?string $filter = null,
6363
#[ConsoleArgument(description: 'Crawl the site for dead links')]
6464
bool $crawl = false,
65-
#[ConsoleArgument(description: 'Allow dead links, only works when the --crawl flag is set')]
66-
bool $allowDeadLinks = false,
67-
#[ConsoleArgument(description: 'Allow external dead links, only works when the --crawl flag is set')]
68-
bool $allowExternalDeadLinks = true,
65+
#[ConsoleArgument(description: 'Crawl external links, only works when the --crawl flag is set')]
66+
bool $external = false,
6967
#[ConsoleArgument(aliases: ['v'])]
7068
bool $verbose = false,
7169
): ExitCode {
@@ -155,9 +153,9 @@ public function __invoke(
155153
}
156154

157155
if ($crawl) {
158-
$deadLinks = $this->detectDeadLinks($uri, $content, checkExternal: ! $allowExternalDeadLinks);
156+
$deadLinks = $this->detectDeadLinks($uri, $content, checkExternal: $external);
159157

160-
if (! $allowDeadLinks && $deadLinks !== []) {
158+
if ($deadLinks !== []) {
161159
$deadlinks[$uri] = $deadLinks;
162160
throw new DeadLinksDetectedException($uri, $deadLinks);
163161
}

tests/Integration/Http/Static/StaticGenerateCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function test_dead_link_with_redirect(): void
112112
$this->container->config(new AppConfig(baseUri: 'https://test.com'));
113113

114114
$this->console
115-
->call(StaticGenerateCommand::class, ['--crawl' => true, '--allow-external-dead-links' => false])
115+
->call(StaticGenerateCommand::class, ['--crawl' => true])
116116
->assertExitCode(ExitCode::SUCCESS);
117117
}
118118

@@ -124,7 +124,7 @@ public function test_allow_dead_links(): void
124124
$this->container->config(new AppConfig(baseUri: 'https://test.com'));
125125

126126
$this->console
127-
->call(StaticGenerateCommand::class, ['--crawl' => true, '--allow-dead-links' => true])
127+
->call(StaticGenerateCommand::class, ['--crawl' => false])
128128
->assertExitCode(ExitCode::SUCCESS);
129129
}
130130

@@ -136,7 +136,7 @@ public function test_external_dead_links(): void
136136
$this->container->config(new AppConfig(baseUri: 'https://test.com'));
137137

138138
$this->console
139-
->call(StaticGenerateCommand::class, ['--crawl' => true, '--allow-external-dead-links' => false])
139+
->call(StaticGenerateCommand::class, ['--crawl' => true, '--external' => true])
140140
->assertSee('2 DEAD LINKS')
141141
->assertSee('https://test.com/404')
142142
->assertSee('https://google.com/404')

0 commit comments

Comments
 (0)