Refactor main code into function
This commit is contained in:
parent
33b91986a1
commit
47e6ee9ca8
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user