Skip to content

Commit 38609f5

Browse files
committed
Shortening changelog via clickable link
1 parent a5f2deb commit 38609f5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Command/UpdateRecipesCommand.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
142142
return 0;
143143
}
144144

145-
$io->write(sprintf(' Updating recipe for <info>%s</info>...', $packageName));
145+
$io->write([
146+
sprintf(' Updating recipe for <info>%s</info>...', $packageName),
147+
'',
148+
]);
146149

147150
$recipeUpdate = new RecipeUpdate($originalRecipe, $newRecipe, $symfonyLock, $this->rootDir);
148151
$this->configurator->populateUpdate($recipeUpdate);
@@ -338,13 +341,15 @@ private function generateChangelog(Recipe $originalRecipe): ?array
338341
}
339342

340343
$lines = [];
344+
// borrowed from symfony/console's OutputFormatterStyle
345+
$handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
346+
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
341347
foreach ($pullRequests as $number => $data) {
342-
$lines[] = sprintf(' * <comment>#%s</comment> - %s (<info>@%s</info>)', $number, $data['title'], $data['author']);
343348
$url = $data['url'];
344-
if (method_exists(OutputFormatterStyle::class, 'setHref')) {
345-
$url = sprintf('<href=%s>%s</>', $url, $url);
349+
if ($handlesHrefGracefully) {
350+
$url = "\033]8;;$url\033\\$number\033]8;;\033\\";
346351
}
347-
$lines[] = ' '.$url;
352+
$lines[] = sprintf(' * %s (#%s)', $data['title'], $url);
348353
}
349354

350355
return $lines;

src/GithubApi.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ public function getPullRequestForCommit(string $commit, string $repo): ?array
164164
'number' => $bestItem['number'],
165165
'url' => $bestItem['html_url'],
166166
'title' => $bestItem['title'],
167-
'author' => $bestItem['user']['login'],
168167
];
169168
}
170169

0 commit comments

Comments
 (0)