#!/usr/bin/env php $arg) { if ($k == 0) { continue; } if ($arg[0] == '-') { $arg = explode('=', $arg); switch($arg[0]) { // TODO allow baseUrl to be set via arg case '-h': case '--help': echo "jssearch index builder\n"; echo "----------------------\n\n"; echo "by Carsten Brandt \n\n"; usage(); break; default: error("Unknown argument " . $arg[0], "usage"); } } else { $src[] = $arg; } } if (empty($src)) { error("You have to give an input directory.", "usage"); } $indexer = new \cebe\jssearch\Indexer(); foreach($src as $dir) { echo "Processing $dir\n"; $files = findFiles($dir); if (empty($files)) { echo "No files where found in $dir.\n"; } else { $indexer->indexFiles($files, $dir); } } $js = $indexer->exportJs(); file_put_contents('jssearch.index.js', $js); // functions /** * Display usage information */ function usage() { global $argv; $cmd = $argv[0]; echo <<