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 Module extends ObjectWriter
16{
17	protected function configure()
18	{
19		$this
20			->setName('profile:export:module')
21			->setDescription('Export a module definition')
22			->addArgument(
23				'module',
24				InputArgument::REQUIRED,
25				'Module ID'
26			);
27
28		parent::configure();
29	}
30
31	protected function execute(InputInterface $input, OutputInterface $output)
32	{
33		$moduleId = $input->getArgument('module');
34
35		$writer = $this->getProfileWriter($input);
36
37		$result = \Tiki_Profile_InstallHandler_Module::export($writer, $moduleId);
38
39		if ($result) {
40			$writer->save();
41		} else {
42			$output->writeln("Module not found: $moduleId");
43		}
44	}
45}
46