From e6749261f1797cd4bb9b93398ed92ae5d9c32b26 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Nov 2013 14:16:34 +0100 Subject: [ticket/12039] Use an abstract class and some more minor adjustments PHPBB3-12039 --- phpBB/phpbb/console/command/config/get.php | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 phpBB/phpbb/console/command/config/get.php (limited to 'phpBB/phpbb/console/command/config/get.php') diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php new file mode 100644 index 0000000000..aeb40cff16 --- /dev/null +++ b/phpBB/phpbb/console/command/config/get.php @@ -0,0 +1,44 @@ +setName('config:get') + ->setDescription("Gets a configuration option's value") + ->addArgument( + 'key', + InputArgument::REQUIRED, + "The configuration option's name" + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('key'); + + if (isset($this->config[$key])) + { + $output->writeln("{$this->config[$key]}"); + } + else + { + $output->writeln("Could not get config $key"); + } + } +} -- cgit v1.2.1 From 52c452c768b30fa479e91faee548abf5038f2642 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jan 2014 23:56:50 +0100 Subject: [ticket/12039] Do not colour returned value in get command PHPBB3-12039 --- phpBB/phpbb/console/command/config/get.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/get.php') diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index aeb40cff16..1f9781ea9c 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -34,7 +34,7 @@ class get extends command if (isset($this->config[$key])) { - $output->writeln("{$this->config[$key]}"); + $output->writeln($this->config[$key]); } else { -- cgit v1.2.1 From a70973ea423fda2a26fc8ff17e6e9c33bee11547 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 9 Jan 2014 00:05:32 +0100 Subject: [ticket/12039] Allow getting the value without a new line at the end PHPBB3-12039 --- phpBB/phpbb/console/command/config/get.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/get.php') diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index 1f9781ea9c..275c82b53f 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -25,6 +25,12 @@ class get extends command InputArgument::REQUIRED, "The configuration option's name" ) + ->addOption( + 'no-newline', + null, + InputOption::VALUE_NONE, + 'Set this option if the value should be printed without a new line at the end.' + ) ; } @@ -32,7 +38,11 @@ class get extends command { $key = $input->getArgument('key'); - if (isset($this->config[$key])) + if (isset($this->config[$key]) && $input->getOption('no-newline')) + { + $output->write($this->config[$key]); + } + elseif (isset($this->config[$key])) { $output->writeln($this->config[$key]); } -- cgit v1.2.1