Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaki Kawabata Neto <masaki.kawabata@gmail.com>2013-08-29 17:00:30 +0400
committerMasaki Kawabata Neto <masaki.kawabata@gmail.com>2013-08-29 17:00:30 +0400
commit98a04d7c73f2969d6b08f4d925f53fb8e9f34c7e (patch)
tree0f1a5058e2a592c525a0ca061ecbcbc918a8fc2c /console.php
parent301cce54ccdc1dcd1bd63bf4285e870e300979b7 (diff)
added help and status commands
switch structure enables many commands seamlessy. also added some help and status command.
Diffstat (limited to 'console.php')
-rw-r--r--console.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/console.php b/console.php
index 4aec5bdc24f..a2d4ab3562e 100644
--- a/console.php
+++ b/console.php
@@ -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;
}