Fix isolate_tests when run with single files and add usage information

This commit is contained in:
Marenz 2021-07-01 15:18:32 +02:00
parent 7f65f1cc02
commit f62b80530b

View File

@ -106,13 +106,18 @@ def extract_and_write(f, path):
write_cases(f, cases)
if __name__ == '__main__':
if len(sys.argv) == 1:
print("Usage: " + sys.argv[0] + " path-to-file-or-folder-to-extract-code-from [docs]")
exit(1)
path = sys.argv[1]
docs = False
if len(sys.argv) > 2 and sys.argv[2] == 'docs':
docs = True
if isfile(path):
extract_and_write(path, path)
_, tail = split(path)
extract_and_write(tail, path)
else:
for root, subdirs, files in os.walk(path):
if '_build' in subdirs: