diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-19 13:32:52 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-19 13:32:52 +0100 |
commit | 582066625416dca2c0f307a1608dd6f009370bcd (patch) | |
tree | a6843821bba12c8ce498dbaafa2ad7d14e49875d /lib | |
parent | 1106c354acd8ebc23b1a19662232d8f6235bc96d (diff) | |
parent | 972e0c62b38d0a77023b6771c0f8867b1c33d8c4 (diff) | |
download | nextcloud-server-582066625416dca2c0f307a1608dd6f009370bcd.tar.gz nextcloud-server-582066625416dca2c0f307a1608dd6f009370bcd.zip |
Merge pull request #22218 from owncloud/occ-no-extra-messages
Add global --no-warnings option to occ…
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()) { |