Add directory input support to nimpretty (#23590)

Feel free to close if this an unwanted addition :)
This commit is contained in:
Mads Hougesen
2024-05-10 10:33:03 +02:00
committed by GitHub
parent 42486e1b2f
commit ee59597cd4

View File

@@ -116,7 +116,13 @@ proc main =
for kind, key, val in getopt():
case kind
of cmdArgument:
infiles.add(key.addFileExt(".nim"))
if dirExists(key):
for file in walkDirRec(key, skipSpecial = true):
if file.endsWith(".nim") or file.endsWith(".nimble"):
infiles.add(file)
else:
infiles.add(key.addFileExt(".nim"))
of cmdLongOption, cmdShortOption:
case normalize(key)
of "help", "h": writeHelp()