Skip to content

Commit 5c4dc47

Browse files
Merge pull request #594 from MauricioFauth/remove-alt-bin-scripts
Remove alternative executable files
2 parents f4b2a20 + c236c90 commit 5c4dc47

File tree

9 files changed

+58
-157
lines changed

9 files changed

+58
-157
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,26 @@ The API documentation is available at
3434
Command line utility to syntax highlight SQL query:
3535

3636
```sh
37-
./vendor/bin/highlight-query --query "SELECT 1"
37+
./vendor/bin/sql-parser --highlight --query "SELECT 1"
3838
```
3939

4040
Command line utility to lint SQL query:
4141

4242
```sh
43-
./vendor/bin/lint-query --query "SELECT 1"
43+
./vendor/bin/sql-parser --lint --query "SELECT 1"
4444
```
4545

4646
Command line utility to tokenize SQL query:
4747

4848
```sh
49-
./vendor/bin/tokenize-query --query "SELECT 1"
49+
./vendor/bin/sql-parser --tokenize --query "SELECT 1"
5050
```
5151

5252
All commands are able to parse input from stdin (standard in), such as:
5353

5454
```sh
55-
echo "SELECT 1" | ./vendor/bin/highlight-query
56-
cat example.sql | ./vendor/bin/lint-query
55+
echo "SELECT 1" | ./vendor/bin/sql-parser --highlight
56+
cat example.sql | ./vendor/bin/sql-parser --lint
5757
```
5858

5959
### Formatting SQL query
@@ -116,7 +116,7 @@ The locale is automatically detected from your environment, you can also set a d
116116
**From cli**:
117117

118118
```sh
119-
LC_ALL=pl ./vendor/bin/lint-query --query "SELECT 1"
119+
LC_ALL=pl ./vendor/bin/sql-parser --lint --query "SELECT 1"
120120
```
121121

122122
**From php**:

bin/highlight-query

-30
This file was deleted.

bin/lint-query

-30
This file was deleted.

bin/tokenize-query

-30
This file was deleted.

composer.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
"phpmyadmin/motranslator": "Translate messages to your favorite locale"
4646
},
4747
"bin": [
48-
"bin/highlight-query",
49-
"bin/lint-query",
50-
"bin/sql-parser",
51-
"bin/tokenize-query"
48+
"bin/sql-parser"
5249
],
5350
"autoload": {
5451
"psr-4": {

phpstan.neon.dist

-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ includes:
33
parameters:
44
level: max
55
paths:
6-
- bin/highlight-query
7-
- bin/lint-query
86
- bin/sql-parser
9-
- bin/tokenize-query
107
- src
118
- tests
129
- tools

psalm.xml

-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
findUnusedCode="true"
1111
>
1212
<projectFiles>
13-
<file name="bin/highlight-query"/>
14-
<file name="bin/lint-query"/>
1513
<file name="bin/sql-parser"/>
16-
<file name="bin/tokenize-query"/>
1714
<directory name="src"/>
1815
<directory name="tests"/>
1916
<directory name="tools"/>

src/Utils/CLI.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ public function run(): int
3333
$params = $this->getopt('', ['lint', 'highlight', 'tokenize']);
3434
if ($params !== false) {
3535
if (isset($params['lint'])) {
36-
return $this->runLint(false);
36+
return $this->runLint();
3737
}
3838

3939
if (isset($params['highlight'])) {
40-
return $this->runHighlight(false);
40+
return $this->runHighlight();
4141
}
4242

4343
if (isset($params['tokenize'])) {
44-
return $this->runTokenize(false);
44+
return $this->runTokenize();
4545
}
4646
}
4747

48-
$this->usageLint(false);
49-
$this->usageHighlight(false);
50-
$this->usageTokenize(false);
48+
$this->usageLint();
49+
$this->usageHighlight();
50+
$this->usageTokenize();
5151

5252
return 1;
5353
}
@@ -68,9 +68,9 @@ public function mergeLongOpts(array &$params, array &$longopts): void
6868
}
6969
}
7070

71-
public function usageHighlight(bool $isStandalone = true): void
71+
public function usageHighlight(): void
7272
{
73-
$command = $isStandalone ? 'highlight-query' : 'sql-parser --highlight';
73+
$command = 'sql-parser --highlight';
7474

7575
echo 'Usage: ' . $command . ' --query SQL [--format html|cli|text] [--ansi]' . "\n";
7676
echo ' cat file.sql | ' . $command . "\n";
@@ -114,15 +114,15 @@ public function parseHighlight(): array|false
114114
return $params;
115115
}
116116

117-
public function runHighlight(bool $isStandalone = true): int
117+
public function runHighlight(): int
118118
{
119119
$params = $this->parseHighlight();
120120
if ($params === false) {
121121
return 1;
122122
}
123123

124124
if (isset($params['h'])) {
125-
$this->usageHighlight($isStandalone);
125+
$this->usageHighlight();
126126

127127
return 0;
128128
}
@@ -150,14 +150,14 @@ public function runHighlight(bool $isStandalone = true): int
150150
}
151151

152152
echo "ERROR: Missing parameters!\n";
153-
$this->usageHighlight($isStandalone);
153+
$this->usageHighlight();
154154

155155
return 1;
156156
}
157157

158-
public function usageLint(bool $isStandalone = true): void
158+
public function usageLint(): void
159159
{
160-
$command = $isStandalone ? 'lint-query' : 'sql-parser --lint';
160+
$command = 'sql-parser --lint';
161161

162162
echo 'Usage: ' . $command . ' --query SQL [--ansi]' . "\n";
163163
echo ' cat file.sql | ' . $command . "\n";
@@ -182,15 +182,15 @@ public function parseLint(): array|false
182182
return $params;
183183
}
184184

185-
public function runLint(bool $isStandalone = true): int
185+
public function runLint(): int
186186
{
187187
$params = $this->parseLint();
188188
if ($params === false) {
189189
return 1;
190190
}
191191

192192
if (isset($params['h'])) {
193-
$this->usageLint($isStandalone);
193+
$this->usageLint();
194194

195195
return 0;
196196
}
@@ -227,14 +227,14 @@ public function runLint(bool $isStandalone = true): int
227227
}
228228

229229
echo "ERROR: Missing parameters!\n";
230-
$this->usageLint($isStandalone);
230+
$this->usageLint();
231231

232232
return 1;
233233
}
234234

235-
public function usageTokenize(bool $isStandalone = true): void
235+
public function usageTokenize(): void
236236
{
237-
$command = $isStandalone ? 'tokenize-query' : 'sql-parser --tokenize';
237+
$command = 'sql-parser --tokenize';
238238

239239
echo 'Usage: ' . $command . ' --query SQL [--ansi]' . "\n";
240240
echo ' cat file.sql | ' . $command . "\n";
@@ -258,15 +258,15 @@ public function parseTokenize(): array|false
258258
return $params;
259259
}
260260

261-
public function runTokenize(bool $isStandalone = true): int
261+
public function runTokenize(): int
262262
{
263263
$params = $this->parseTokenize();
264264
if ($params === false) {
265265
return 1;
266266
}
267267

268268
if (isset($params['h'])) {
269-
$this->usageTokenize($isStandalone);
269+
$this->usageTokenize();
270270

271271
return 0;
272272
}
@@ -302,7 +302,7 @@ public function runTokenize(bool $isStandalone = true): int
302302
}
303303

304304
echo "ERROR: Missing parameters!\n";
305-
$this->usageTokenize($isStandalone);
305+
$this->usageTokenize();
306306

307307
return 1;
308308
}

0 commit comments

Comments
 (0)