Refactor main code into function

This commit is contained in:
Nicolo P 2022-02-23 23:15:57 +01:00
parent 33b91986a1
commit 47e6ee9ca8

View File

@ -158,8 +158,7 @@ def process_grep(args_tree: dict) -> list:
return found_lines return found_lines
# When the script is executed directly... def main():
if __name__ == "__main__":
args = sys.argv[1:] args = sys.argv[1:]
if not check_args(args): if not check_args(args):
@ -179,3 +178,8 @@ if __name__ == "__main__":
except exceptions.InvalidPatternError as e: except exceptions.InvalidPatternError as e:
print(e.get_message()) print(e.get_message())
sys.exit(1) sys.exit(1)
# When the script is executed directly...
if __name__ == "__main__":
main()