Skip to content

Commit d592cd7

Browse files
committed
[Icons] Improve icons:lock command verbosity
* display "Icon Not Found" (verbose) * display "IconSet Not Found" (very verbose)
1 parent c9bf5ee commit d592cd7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Icons/src/Command/LockIconsCommand.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7272

7373
[$prefix, $name] = $parts;
7474

75+
if (!$this->iconify->hasIconSet($prefix)) {
76+
// not an icon set? example: "og:twitter"
77+
if ($io->isVeryVerbose()) {
78+
$io->writeln(\sprintf(' <fg=bright-yellow;options=bold>✗</> IconSet Not Found: <fg=bright-white;bg=black>%s:%s</>.', $prefix, $name));
79+
}
80+
continue;
81+
}
82+
7583
try {
7684
$svg = $this->iconify->fetchSvg($prefix, $name);
7785
} catch (IconNotFoundException) {
7886
// icon not found on iconify
87+
if ($io->isVerbose()) {
88+
$io->writeln(\sprintf(' <fg=bright-red;options=bold>✗</> Icon Not Found: <fg=bright-white;bg=black>%s:%s</>.', $prefix, $name));
89+
}
7990
continue;
8091
}
8192

@@ -84,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8495
$license = $this->iconify->metadataFor($prefix)['license'];
8596
++$count;
8697

87-
$io->text(\sprintf(
98+
$io->writeln(\sprintf(
8899
" <fg=bright-green;options=bold>✓</> Imported <fg=bright-white;bg=black>%s:</><fg=bright-magenta;bg=black;options>%s</> (License: <href=%s>%s</>). Render with: <comment>{{ ux_icon('%s') }}</comment>",
89100
$prefix,
90101
$name,

src/Icons/src/Iconify.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public function fetchSvg(string $prefix, string $name): string
9999
return $content;
100100
}
101101

102+
public function hasIconSet(string $prefix): bool
103+
{
104+
return isset($this->sets()[$prefix]);
105+
}
106+
102107
public function getIconSets(): array
103108
{
104109
return $this->sets()->getArrayCopy();

0 commit comments

Comments
 (0)