diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2016-02-18 02:42:00 +0300 |
---|---|---|
committer | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2016-02-19 00:33:48 +0300 |
commit | 972e0c62b38d0a77023b6771c0f8867b1c33d8c4 (patch) | |
tree | 090e6730cddd908d82eda780f18e93a8563422c5 /lib | |
parent | 99051cdbe54c6efa131498f699c1d29642885c74 (diff) | |
download | nextcloud-server-972e0c62b38d0a77023b6771c0f8867b1c33d8c4.tar.gz nextcloud-server-972e0c62b38d0a77023b6771c0f8867b1c33d8c4.zip |
Add global --no-warning option to occ in order not to pollute output with warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/console/application.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/private/console/application.php b/lib/private/console/application.php index 10ff69b1c80..0895f1788af 100644 --- a/lib/private/console/application.php +++ b/lib/private/console/application.php @@ -31,6 +31,7 @@ use OCP\IRequest; use Symfony\Component\Console\Application as SymfonyApplication; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -56,12 +57,31 @@ class Application { } /** + * @param InputInterface $input * @param OutputInterface $output * @throws \Exception */ - public function loadCommands(OutputInterface $output) { + public function loadCommands(InputInterface $input, OutputInterface $output) { // $application is required to be defined in the register_command scripts $application = $this->application; + $inputDefinition = $application->getDefinition(); + $inputDefinition->addOption( + new InputOption( + 'no-warnings', + null, + InputOption::VALUE_NONE, + 'Skip global warnings, show command output only', + null + ) + ); + try { + $input->bind($inputDefinition); + } catch (\RuntimeException $e) { + //expected if there are extra options + } + if ($input->getOption('no-warnings')) { + $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); + } require_once __DIR__ . '/../../../core/register_command.php'; if ($this->config->getSystemValue('installed', false)) { if (\OCP\Util::needUpgrade()) { |