sys.exit(1) if globbing matches no files/directories

After more testing, I realized that I did not take into account the possibility that the wildcard pattern would not match anything. In that case, the following 'if not arguments' clause would run wmllint on the entire current directory - which could very well be something that you do not want!
This commit is contained in:
Groggy Dice 2013-07-26 01:32:05 -04:00
parent 45611d8fa6
commit c471ec4847

View file

@ -2427,7 +2427,11 @@ if __name__ == '__main__':
for arg in arguments:
for wild in glob(arg):
newargs.append(wild)
arguments = newargs
if newargs:
arguments = newargs
else:
sys.stderr.write('wmllint: wildcard did not match any files or directories (%s)\n'%arguments)
sys.exit(1)
if not arguments:
arguments = ["."]