echo "Are you sure you want to clear the collection '" . $collection . "'? (yes|no)\n"; $in = explode(' ', trim(fgets(STDIN))); if ($in[0] != 'yes') { echo "Aborted.\n"; break; } db_execute('delete from ' . $collection); echo "Collection cleared.\n"; break; case 'root': if (!$collection) { echo "Error: no collection in use.\n"; break; } if ($input[1]) { $ns->root($input[1]); } else { echo $ns->root() . "\n"; } break; case 'addRoot': if (!$collection) { echo "Error: no collection in use.\n"; break; } elseif (!$input[1]) { echo "Error: no root ID specified.\n"; break; } array_shift($input); $fields = array(); foreach ($input as $k => $v) {