Skip to content

Commit a87d15f

Browse files
staabmclxmstaab
andauthored
args help, strip .php extension from the cli tool (#3)
Co-authored-by: Markus Staab <[email protected]>
1 parent e29d857 commit a87d15f

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

bin/phpstan-baseline-analyze

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require 'phpstan-baseline-analyze.php';

bin/phpstan-baseline-analyze.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env php
21
<?php
32

43
// Finding composer
@@ -16,4 +15,11 @@
1615
}
1716

1817
$app = new \staabm\PHPStanBaselineAnalysis\Application();
19-
$app->start($argv[1]);
18+
19+
if ($argc <= 1) {
20+
$app->help();
21+
exit(1);
22+
}
23+
24+
$app->start($argv[1]);
25+
exit(0);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"phpunit": "phpunit"
3131
},
3232
"bin": [
33-
"bin/phpstan-baseline-analyze.php"
33+
"bin/phpstan-baseline-analyze"
3434
]
3535
}

lib/Application.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ public function start(string $glob): void
1818
printf(" Overall-Complexity: %s\n", $result->overallComplexity);
1919
}
2020
}
21+
22+
public function help(): void
23+
{
24+
printf('USAGE: phpstan-baseline-analyze <GLOB-PATTERN>');
25+
}
2126
}

0 commit comments

Comments
 (0)