Tim Starling has submitted this change and it was merged.

Change subject: lint.php: Support file as argument
......................................................................


lint.php: Support file as argument

Change-Id: I1a219faf8dac616f694f1308ca7e789ae8c81350
---
M lint.php
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Tim Starling: Verified; Looks good to me, approved



diff --git a/lint.php b/lint.php
index 49e5fae..da063f5 100755
--- a/lint.php
+++ b/lint.php
@@ -53,17 +53,18 @@
 }
 
 if ( isset( $argv[1] ) ) {
-       $dir = $argv[1];
-       if ( !is_dir( $dir ) ) {
-               echo "Not a directory: $dir\n";
+       $path = $argv[1];
+       if ( !file_exists( $path ) ) {
+               echo "Path not found: $path\n";
                exit( 1 );
        }
 } else {
        $dir = '.';
 }
 
-if ( !check_dir( $dir ) ) {
+$ret = is_dir( $path ) ? check_dir( $path ) : check_file( $path );
+if ( !$ret ) {
        exit( 1 );
 } else {
        exit( 0 );
-}
\ No newline at end of file
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/57828
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1a219faf8dac616f694f1308ca7e789ae8c81350
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/code-utils
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Platonides <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to