Skip to content

Commit bc65061

Browse files
committed
feat(hosts): output generated lines on listen
1 parent c1eb978 commit bc65061

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.php-cs-fixer.cache

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/Service/SynchronizeHostsFileService.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,23 @@ private function regenerateHostsFile(): void
136136
);
137137
};
138138

139+
$hostsFileLines = array_map($convertContainerToLine, $this->activeContainers);
140+
139141
$hosts = array_merge(
140142
[self::START_TAG],
141-
array_map($convertContainerToLine, $this->activeContainers),
143+
$hostsFileLines,
142144
[self::END_TAG]
143145
);
144146
array_splice($content, $start, $end - $start + 1, $hosts);
145147
file_put_contents($this->hostsFile, implode("\n", $content));
146148
if ($this->consoleOutput?->isVerbose()) {
147149
$this->consoleOutput->writeln('[+] Updated hosts file');
150+
151+
$table = $this->consoleOutput->createTable();
152+
foreach ($hostsFileLines as $hostsFileLine) {
153+
$table->addRow([$hostsFileLine]);
154+
}
155+
$table->render();
148156
}
149157
}
150158
}

0 commit comments

Comments
 (0)