format.py: Error out if no files found to format. (#56)

This can happen if the script is run from a directory other than the
project root or styleguide.
This commit is contained in:
Peter Johnson
2016-05-24 22:16:53 -07:00
parent 565a125dad
commit eb51de65e5

View File

@@ -42,6 +42,10 @@ clangExec = "clang-format"
if sys.platform.startswith("win32"):
clangExec += ".exe"
if not files:
print("Error: no files found to format", file=sys.stderr)
sys.exit(1)
for name in files:
# List names of files as they are processed if verbose flag was given
if len(sys.argv) > 1 and sys.argv[1] == "-v":