Skip to content

Commit 1c1abcc

Browse files
committed
Allow to specify context on lint-query
Signed-off-by: Michal Čihař <michal@cihar.com>
1 parent 0e66584 commit 1c1abcc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Utils/CLI.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace PhpMyAdmin\SqlParser\Utils;
88

9+
use PhpMyAdmin\SqlParser\Context;
910
use PhpMyAdmin\SqlParser\Lexer;
1011
use PhpMyAdmin\SqlParser\Parser;
1112

@@ -92,9 +93,9 @@ public function usageLint()
9293

9394
public function parseLint()
9495
{
95-
$longopts = array('help', 'query:');
96+
$longopts = array('help', 'query:', 'context:');
9697
$params = $this->getopt(
97-
'hq:', $longopts
98+
'hq:c:', $longopts
9899
);
99100
$this->mergeLongOpts($params, $longopts);
100101

@@ -112,6 +113,9 @@ public function runLint()
112113

113114
return 0;
114115
}
116+
if (isset($params['c'])) {
117+
Context::load($params['c']);
118+
}
115119
if (isset($params['q'])) {
116120
$lexer = new Lexer($params['q'], false);
117121
$parser = new Parser($lexer->list);

0 commit comments

Comments
 (0)