summaryrefslogtreecommitdiffstats
path: root/console.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-09-01 16:40:50 +0200
committerBart Visscher <bartv@thisnet.nl>2013-09-01 16:40:50 +0200
commit0aba549e7f11e1035fa7a2e880803b47cbadd919 (patch)
treef2ba9c9cd15a555e2864764824d96b362653dbe6 /console.php
parent92e90c8eb995c886b3e9cd77c14e3f0b25b95cd7 (diff)
downloadnextcloud-server-0aba549e7f11e1035fa7a2e880803b47cbadd919.tar.gz
nextcloud-server-0aba549e7f11e1035fa7a2e880803b47cbadd919.zip
Use more object oriented way for console commands
Diffstat (limited to 'console.php')
-rw-r--r--console.php37
1 files changed, 8 insertions, 29 deletions
diff --git a/console.php b/console.php
index fbe09d9bb68..9639f60b7ac 100644
--- a/console.php
+++ b/console.php
@@ -7,6 +7,9 @@
* See the COPYING-README file.
*/
+use OC\Core\Command\GreetCommand;
+use Symfony\Component\Console\Application;
+
$RUNTIME_NOAPPS = true;
require_once 'lib/base.php';
@@ -21,32 +24,8 @@ if (!OC::$CLI) {
exit(0);
}
-$self = basename($argv[0]);
-if ($argc <= 1) {
- $argv[1] = "help";
-}
-
-$command = $argv[1];
-array_shift($argv);
-
-switch ($command) {
- case 'files:scan':
- require_once 'apps/files/console/scan.php';
- break;
- case 'status':
- require_once 'status.php';
- break;
- case 'help':
- echo "Usage:" . PHP_EOL;
- echo " " . $self . " <command>" . PHP_EOL;
- echo PHP_EOL;
- echo "Available commands:" . PHP_EOL;
- echo " files:scan -> rescan filesystem" .PHP_EOL;
- echo " status -> show some status information" .PHP_EOL;
- echo " help -> show this help screen" .PHP_EOL;
- break;
- default:
- echo "Unknown command '$command'" . PHP_EOL;
- echo "For available commands type ". $self . " help" . PHP_EOL;
- break;
-}
+$defaults = new OC_Defaults;
+$application = new Application($defaults->getName(), \OC_Util::getVersionString());
+$application->add(new OC\Core\Command\Status);
+$application->add(new OCA\Files\Command\Scan);
+$application->run();