]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
console.php: fix up the help and include a handy cut-n-paste'able example
authorBrion Vibber <brion@pobox.com>
Fri, 6 Nov 2009 14:03:03 +0000 (15:03 +0100)
committerBrion Vibber <brion@pobox.com>
Fri, 6 Nov 2009 14:03:13 +0000 (15:03 +0100)
scripts/console.php

index e65529a8d247d4227169dbbb1ef97abaa75faba1..f1b089a7cd1c613aa6de796b03df126e523df2bb 100755 (executable)
@@ -110,12 +110,21 @@ function readline_emulation($prompt)
 function console_help()
 {
     print "Welcome to StatusNet's interactive PHP console!\n";
-    print "Type some PHP code and it'll run!\n";
+    print "Type some PHP code and it'll execute...\n";
     print "\n";
-    print "Note that PHP is cranky and you can easily kill your session.\n";
+    print "Hint: return a value of any time to output it via var_export():\n";
+    print "  \$profile = new Profile();\n";
+    print "  \$profile->find();\n";
+    print "  \$profile->fetch();\n";
+    print "  return \$profile;\n";
+    print "\n";
+    print "Note that PHP is cranky and you can easily kill your session by mistyping.\n";
+    print "\n";
+    print "Type ctrl+D or enter 'exit' to exit.\n";
 }
 
 
+print "StatusNet interactive PHP console... type ctrl+D or enter 'exit' to exit.\n";
 $prompt = common_config('site', 'name') . '> ';
 while (!feof(STDIN)) {
     $line = read_input_line($prompt);
@@ -124,14 +133,14 @@ while (!feof(STDIN)) {
         break;
     } elseif ($line !== '') {
         try {
-            if ($line == 'exit') {
+            if (trim($line) == 'exit') {
                 break;
-            } elseif ($line == 'help') {
+            } elseif (trim($line) == 'help') {
                 console_help();
                 continue;
             }
             
-            // Let's do this
+            // Let's do this!
             $result = eval($line);
             if ($result === false) {
                 // parse error