]> source.dussan.org Git - nextcloud-server.git/commitdiff
added help and status commands
authorMasaki Kawabata Neto <masaki.kawabata@gmail.com>
Thu, 29 Aug 2013 13:00:30 +0000 (10:00 -0300)
committerMasaki Kawabata Neto <masaki.kawabata@gmail.com>
Thu, 29 Aug 2013 13:00:30 +0000 (10:00 -0300)
switch structure enables many commands seamlessy.
also added some help and status command.

console.php

index 4aec5bdc24ffe1bb32ca0ddb0d9bc8f1b4499457..a2d4ab3562e0890beac23e7966d844ce422a94eb 100644 (file)
@@ -20,17 +20,32 @@ if (!OC::$CLI) {
        exit(0);
 }
 
+$self = basename($argv[0]);
 if ($argc <= 1) {
-       echo "Usage:" . PHP_EOL;
-       echo " " . basename($argv[0]) . " <command>" . PHP_EOL;
-       exit(0);
+        $argv[1] = "help";
 }
 
 $command = $argv[1];
 array_shift($argv);
 
-if ($command === 'files:scan') {
-       require_once 'apps/files/console/scan.php';
-} else {
-       echo "Unknown command '$command'" . PHP_EOL;
+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;
 }