diff options
author | Michal Čihař <michal@cihar.com> | 2016-03-18 11:16:02 +0100 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2016-03-18 11:16:02 +0100 |
commit | c258b56f669e13c041a754c8ca476b4ea8366e91 (patch) | |
tree | 6e04fbf11ce2532f36b9eb4dc96ac59bbf8336ca /bin | |
parent | bc0fc19c67dab8759224d6323b477ea825843470 (diff) | |
download | sql-parser-c258b56f669e13c041a754c8ca476b4ea8366e91.zip sql-parser-c258b56f669e13c041a754c8ca476b4ea8366e91.tar.gz sql-parser-c258b56f669e13c041a754c8ca476b4ea8366e91.tar.bz2 |
Add command line script for highlighting SQL query
Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/highlight-query | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/highlight-query b/bin/highlight-query new file mode 100755 index 0000000..fe916d9 --- /dev/null +++ b/bin/highlight-query @@ -0,0 +1,29 @@ +#!/usr/bin/env php +<?php + +$files = array( + __DIR__ . "/../vendor/autoload.php", + __DIR__ . "/../../vendor/autoload.php", + __DIR__ . "/../../../autoload.php", + "vendor/autoload.php" +); + +$found = false; +foreach ($files as $file) { + if (file_exists($file)) { + require_once $file; + $found = true; + break; + } +} + +if (!$found) { + die( + "You need to set up the project dependencies using the following commands:" . PHP_EOL . + "curl -s http://getcomposer.org/installer | php" . PHP_EOL . + "php composer.phar install" . PHP_EOL + ); +} + +$cli = new SqlParser\Utils\CLI(); +exit($cli->run()); |