setName('files:windows-compatible-filenames')
->setDescription('Enforce naming constraints for windows compatible filenames')
->addOption('enable', description: 'Enable windows naming constraints')
->addOption('disable', description: 'Disable windows naming constraints');
}
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('enable')) {
if ($this->service->hasFilesWindowsSupport()) {
$output->writeln('Windows compatible filenames already enforced.', OutputInterface::VERBOSITY_VERBOSE);
}
$this->service->setFilesWindowsSupport(true);
$output->writeln('Windows compatible filenames enforced.');
} elseif ($input->getOption('disable')) {
if (!$this->service->hasFilesWindowsSupport()) {
$output->writeln('Windows compatible filenames already disabled.', OutputInterface::VERBOSITY_VERBOSE);
}
$this->service->setFilesWindowsSupport(false);
$output->writeln('Windows compatible filename constraints removed.');
} else {
$output->writeln('Windows compatible filenames are ' . ($this->service->hasFilesWindowsSupport() ? 'enforced' : 'disabled'));
}
return self::SUCCESS;
}
}