diff --git a/src/Deblan/PowerDNS/Command/ZoneListCommand.php b/src/Deblan/PowerDNS/Command/ZoneListCommand.php new file mode 100644 index 0000000..7e9c34c --- /dev/null +++ b/src/Deblan/PowerDNS/Command/ZoneListCommand.php @@ -0,0 +1,50 @@ +setName('zone:list') + ->setDescription('List DNS zones') + // ->addArgument('foo', InputArgument::OPTIONAL, '') + // ->addOption('bar', null, InputOption::VALUE_NONE, '') + ->setHelp("The %command.name% "); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + // $this->getContainer()->get('foo.bar'); + // $output->writeln(sprintf('%s bar.', $example)); + // $input->getArgument('foo'); + // $input->getOption('bar'); + + $zones = ZoneQuery::create()->orderByName()->find(); + + foreach ($zones as $zone) { + $output->writeln(sprintf('%s.', $zone->getName())); + + if ($zone->getDescription()) { + $output->writeln($zone->getDescription()); + $output->writeln(''); + } + + foreach ($zones->getZoneVersions() as $zoneVersion) { + $output->writeln(sprintf('Version %d', $zoneVersion->getVersion())); + + if ($zoneVersion->getIsActive()) { + $output->writeln('Activeted'); + } + } + } + } +}