Improve CLI

This commit is contained in:
Andras Schmelczer 2022-07-08 13:27:25 +02:00
parent 65ec6d6f9b
commit c2d2bf49f1
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
3 changed files with 15 additions and 7 deletions

View file

@ -11,7 +11,7 @@ from .parse_arguments import parse_arguments
logger = get_logger("large_file")
def main() -> None:
def handle_command() -> None:
parser, args = parse_arguments()
large_file = get_class(args)
@ -61,11 +61,15 @@ def get_class(args: Namespace) -> Type[LargeFileBase]:
return large_file
if __name__ == "__main__":
def main() -> None:
try:
main()
handle_command()
except KeyboardInterrupt:
logger.warning("Exiting")
exit()
except Exception as e:
logger.exception(e)
if __name__ == "__main__":
main()