diff --git a/src/Deblan/PowerDNS/Command/AboutCommand.php b/src/Deblan/PowerDNS/Command/AboutCommand.php
new file mode 100644
index 0000000..26670d2
--- /dev/null
+++ b/src/Deblan/PowerDNS/Command/AboutCommand.php
@@ -0,0 +1,67 @@
+setName('about')
+ ->setDescription('')
+ ->setHelp("The %command.name% ");
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $output->writeln(<<PDNS-CONSOLE
+
+PDNS-Console provided a CLI to manage PowerDNS application and improved it by adding a powerfull DNS zone versionning.
+
+AUTHOR
+
+* Simon Vieille
+* http://www.deblan.fr/
+* simon+github@deblan.fr
+* IRC: irc.neutralnetwork.org (6667, SSL: 6668)
+
+LICENCE
+
+Copyright (c) 2015, Simon Vieille
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of pdns-console nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+EOF
+);
+ }
+}
diff --git a/src/Deblan/PowerDNS/Command/DomainAddCommand.php b/src/Deblan/PowerDNS/Command/DomainAddCommand.php
new file mode 100644
index 0000000..6c274d1
--- /dev/null
+++ b/src/Deblan/PowerDNS/Command/DomainAddCommand.php
@@ -0,0 +1,89 @@
+setName('domain:add')
+ ->setDescription('Add a domain')
+ ->addOption('name', null, InputOption::VALUE_REQUIRED, '')
+ ->addOption('type', null, InputOption::VALUE_REQUIRED, '')
+ ->addOption('master', null, InputOption::VALUE_REQUIRED, '')
+ ->setHelp("The %command.name% ");
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ parent::execute($input, $output);
+
+ $name = $this->getInput()->getOption('name');
+
+ while (null === $name || trim($name) === '') {
+ $name = $this->getHelper('dialog')->ask($this->getOutput(), 'Name: ', null);
+ }
+
+ $master = $this->getInput()->getOption('master');
+
+ if ($master === 'null') {
+ $master = null;
+ } elseif (null === $master || trim($master) === '') {
+ $response = $this->getHelper('dialog')->ask($this->getOutput(), 'MASTER [null]: ', null);
+ $master = empty($response) ? null : $response;
+ }
+
+ $type = $this->getInput()->getOption('type');
+
+ if ($type === 'null') {
+ $type = null;
+ } elseif (null === $type) {
+ $response = $this->getHelper('dialog')->ask($this->getOutput(), 'Type [NATIVE]: ', null);
+ $type = empty($response) ? 'NATIVE' : $response;
+ }
+
+ if (!$this->getHelper('validator')->isDomainMaster($master)) {
+ $this->getOutput()->writeln('Invalid master.');
+
+ return;
+ }
+
+ if (!$this->getHelper('validator')->isDomainName($name)) {
+ $this->getOutput()->writeln('Invalid name.');
+
+ return;
+ }
+
+ if (!$this->getHelper('validator')->isDomainType($type)) {
+ $this->getOutput()->writeln('Invalid type.');
+
+ return;
+ }
+
+ if (DomainQuery::create()->findOneByName($name)) {
+ $this->getOutput()->writeln('The domain already exists.');
+
+ return;
+ }
+
+ $domain = (new Domain())
+ ->setName($name)
+ ->setMaster($master)
+ ->setType($type);
+
+ $domain->save();
+
+ $this->getOutput()->writeln('Domain added.');
+ }
+}
diff --git a/src/Deblan/PowerDNS/Command/DomainListCommand.php b/src/Deblan/PowerDNS/Command/DomainListCommand.php
index 7c0783b..fdd1231 100644
--- a/src/Deblan/PowerDNS/Command/DomainListCommand.php
+++ b/src/Deblan/PowerDNS/Command/DomainListCommand.php
@@ -43,7 +43,7 @@ class DomainListCommand extends AbstractCommand
if ($this->getInput()->getOption('zone') && $domain->getZone()) {
$this->getOutput()->writeln('');
- $this->getHelper('zone')->showZone($domain->getZone());
+ $this->getHelper('zone')->showZone($domain->getZone(), 0, true);
$this->getOutput()->writeln('');
$this->getOutput()->writeln('');
}
diff --git a/src/Deblan/PowerDNS/Command/DomainRemoveCommand.php b/src/Deblan/PowerDNS/Command/DomainRemoveCommand.php
new file mode 100644
index 0000000..75ceb19
--- /dev/null
+++ b/src/Deblan/PowerDNS/Command/DomainRemoveCommand.php
@@ -0,0 +1,72 @@
+setName('domain:remove')
+ ->setDescription('Remove a domain')
+ ->addOption('name', null, InputOption::VALUE_REQUIRED, '')
+ ->addOption('id', null, InputOption::VALUE_REQUIRED, '')
+ ->addOption('confirm', null, InputOption::VALUE_NONE, '')
+ ->setHelp("The %command.name% ");
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ parent::execute($input, $output);
+
+ $name = $this->getInput()->getOption('name');
+ $id = $this->getInput()->getOption('id');
+ $id = $this->getInput()->getOption('id');
+
+ if (null === $name && null === $id) {
+ $this->getOutput()->writeln('You must give a name or an id.');
+
+ return;
+ }
+
+ if ($name) {
+ $domain = $this->getQuery()->findOneByName($name);
+ } else {
+ $domain = $this->getQuery()->findOneById($id);
+ }
+
+ if (null === $domain) {
+ $this->getOutput()->writeln('No domain found.');
+
+ return;
+ }
+
+ $confirm = $this->getInput()->getOption('confirm');
+
+ if (false === $confirm) {
+ $confirm = $this->getHelper('dialog')->askConfirmation($this->getOutput(), 'Do you confirm? [no] ', false);
+ }
+
+ if ($confirm) {
+ $domain->delete();
+
+ $this->getOutput()->writeln('Domain removed.');
+ } else {
+ $this->getOutput()->writeln('Aborted.');
+ }
+ }
+
+ protected function getQuery()
+ {
+ return DomainQuery::create();
+ }
+}