1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8namespace Tiki\Command\ProfileExport;
9
10use Symfony\Component\Console\Input\InputArgument;
11use Symfony\Component\Console\Input\InputInterface;
12use Symfony\Component\Console\Input\InputOption;
13use Symfony\Component\Console\Output\OutputInterface;
14
15class ArticleType extends ObjectWriter
16{
17	protected function configure()
18	{
19		$this
20			->setName('profile:export:article-type')
21			->setDescription('Export an article type definition')
22			->addArgument(
23				'type',
24				InputArgument::REQUIRED,
25				'Type Name'
26			);
27
28		parent::configure();
29	}
30
31	protected function execute(InputInterface $input, OutputInterface $output)
32	{
33		$name = $input->getArgument('type');
34
35		$writer = $this->getProfileWriter($input);
36
37		$result = \Tiki_Profile_InstallHandler_ArticleType::export($writer, $name);
38
39		if ($result) {
40			$writer->save();
41		} else {
42			$output->writeln("Type not found: $name");
43		}
44	}
45}
46