From 90ee2b999df00905d2d8dda225de3eb306acc0e9 Mon Sep 17 00:00:00 2001 From: shanebishop Date: Fri, 31 May 2019 20:23:55 -0400 Subject: [PATCH] Fix for issue 26: Default to CMakeLists.txt in current directory, if one exists --- cmakelint/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmakelint/main.py b/cmakelint/main.py index 23fba6a..e96f955 100644 --- a/cmakelint/main.py +++ b/cmakelint/main.py @@ -87,6 +87,7 @@ whitespace/newline whitespace/tabs """ +_DEFAULT_FILENAME = 'CMakeLists.txt' def DefaultRC(): """ @@ -588,8 +589,10 @@ def ParseArgs(argv): except ValueError as ex: PrintUsage(str(ex)) - if not filenames: + if not filenames and not os.path.isfile(_DEFAULT_FILENAME): PrintUsage('No files were specified!') + elif os.path.isfile(_DEFAULT_FILENAME): + filenames = [_DEFAULT_FILENAME] return filenames def main():