Skip to content

Commit

Permalink
Remove alternative executable files
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
  • Loading branch information
MauricioFauth committed Oct 25, 2024
1 parent f4b2a20 commit c236c90
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 157 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ The API documentation is available at
Command line utility to syntax highlight SQL query:

```sh
./vendor/bin/highlight-query --query "SELECT 1"
./vendor/bin/sql-parser --highlight --query "SELECT 1"
```

Command line utility to lint SQL query:

```sh
./vendor/bin/lint-query --query "SELECT 1"
./vendor/bin/sql-parser --lint --query "SELECT 1"
```

Command line utility to tokenize SQL query:

```sh
./vendor/bin/tokenize-query --query "SELECT 1"
./vendor/bin/sql-parser --tokenize --query "SELECT 1"
```

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

```sh
echo "SELECT 1" | ./vendor/bin/highlight-query
cat example.sql | ./vendor/bin/lint-query
echo "SELECT 1" | ./vendor/bin/sql-parser --highlight
cat example.sql | ./vendor/bin/sql-parser --lint
```

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

```sh
LC_ALL=pl ./vendor/bin/lint-query --query "SELECT 1"
LC_ALL=pl ./vendor/bin/sql-parser --lint --query "SELECT 1"
```

**From php**:
Expand Down
30 changes: 0 additions & 30 deletions bin/highlight-query

This file was deleted.

30 changes: 0 additions & 30 deletions bin/lint-query

This file was deleted.

30 changes: 0 additions & 30 deletions bin/tokenize-query

This file was deleted.

5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
"phpmyadmin/motranslator": "Translate messages to your favorite locale"
},
"bin": [
"bin/highlight-query",
"bin/lint-query",
"bin/sql-parser",
"bin/tokenize-query"
"bin/sql-parser"
],
"autoload": {
"psr-4": {
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ includes:
parameters:
level: max
paths:
- bin/highlight-query
- bin/lint-query
- bin/sql-parser
- bin/tokenize-query
- src
- tests
- tools
Expand Down
3 changes: 0 additions & 3 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
findUnusedCode="true"
>
<projectFiles>
<file name="bin/highlight-query"/>
<file name="bin/lint-query"/>
<file name="bin/sql-parser"/>
<file name="bin/tokenize-query"/>
<directory name="src"/>
<directory name="tests"/>
<directory name="tools"/>
Expand Down
42 changes: 21 additions & 21 deletions src/Utils/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ public function run(): int
$params = $this->getopt('', ['lint', 'highlight', 'tokenize']);
if ($params !== false) {
if (isset($params['lint'])) {
return $this->runLint(false);
return $this->runLint();

Check warning on line 36 in src/Utils/CLI.php

View check run for this annotation

Codecov / codecov/patch

src/Utils/CLI.php#L36

Added line #L36 was not covered by tests
}

if (isset($params['highlight'])) {
return $this->runHighlight(false);
return $this->runHighlight();

Check warning on line 40 in src/Utils/CLI.php

View check run for this annotation

Codecov / codecov/patch

src/Utils/CLI.php#L40

Added line #L40 was not covered by tests
}

if (isset($params['tokenize'])) {
return $this->runTokenize(false);
return $this->runTokenize();

Check warning on line 44 in src/Utils/CLI.php

View check run for this annotation

Codecov / codecov/patch

src/Utils/CLI.php#L44

Added line #L44 was not covered by tests
}
}

$this->usageLint(false);
$this->usageHighlight(false);
$this->usageTokenize(false);
$this->usageLint();
$this->usageHighlight();
$this->usageTokenize();

Check warning on line 50 in src/Utils/CLI.php

View check run for this annotation

Codecov / codecov/patch

src/Utils/CLI.php#L48-L50

Added lines #L48 - L50 were not covered by tests

return 1;
}
Expand All @@ -68,9 +68,9 @@ public function mergeLongOpts(array &$params, array &$longopts): void
}
}

public function usageHighlight(bool $isStandalone = true): void
public function usageHighlight(): void

Check warning on line 71 in src/Utils/CLI.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ $params[$value[0]] = $params[$value]; } } - public function usageHighlight() : void + protected function usageHighlight() : void { $command = 'sql-parser --highlight'; echo 'Usage: ' . $command . ' --query SQL [--format html|cli|text] [--ansi]' . "\n";
{
$command = $isStandalone ? 'highlight-query' : 'sql-parser --highlight';
$command = 'sql-parser --highlight';

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

public function runHighlight(bool $isStandalone = true): int
public function runHighlight(): int
{
$params = $this->parseHighlight();
if ($params === false) {
return 1;
}

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

return 0;
}
Expand Down Expand Up @@ -150,14 +150,14 @@ public function runHighlight(bool $isStandalone = true): int
}

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

return 1;
}

public function usageLint(bool $isStandalone = true): void
public function usageLint(): void

Check warning on line 158 in src/Utils/CLI.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.2

Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ $this->usageHighlight(); return 1; } - public function usageLint() : void + protected function usageLint() : void { $command = 'sql-parser --lint'; echo 'Usage: ' . $command . ' --query SQL [--ansi]' . "\n";
{
$command = $isStandalone ? 'lint-query' : 'sql-parser --lint';
$command = 'sql-parser --lint';

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

public function runLint(bool $isStandalone = true): int
public function runLint(): int
{
$params = $this->parseLint();
if ($params === false) {
return 1;
}

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

return 0;
}
Expand Down Expand Up @@ -227,14 +227,14 @@ public function runLint(bool $isStandalone = true): int
}

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

return 1;
}

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

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

public function runTokenize(bool $isStandalone = true): int
public function runTokenize(): int
{
$params = $this->parseTokenize();
if ($params === false) {
return 1;
}

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

return 0;
}
Expand Down Expand Up @@ -302,7 +302,7 @@ public function runTokenize(bool $isStandalone = true): int
}

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

return 1;
}
Expand Down
Loading

0 comments on commit c236c90

Please sign in to comment.