2020-06-04 17:16:51 +00:00
|
|
|
from typing import NoReturn
|
2020-06-03 17:41:30 +00:00
|
|
|
|
2020-08-27 23:06:57 +00:00
|
|
|
from rich.console import Console
|
|
|
|
from rich.traceback import install
|
2020-09-01 22:08:06 +00:00
|
|
|
from tuxbot import ExitCodes
|
2020-08-27 23:06:57 +00:00
|
|
|
|
|
|
|
console = Console()
|
|
|
|
install(console=console)
|
2020-06-03 17:41:30 +00:00
|
|
|
|
|
|
|
|
2020-06-03 22:46:53 +00:00
|
|
|
def main() -> NoReturn:
|
2020-06-03 17:41:30 +00:00
|
|
|
try:
|
2020-09-01 22:08:06 +00:00
|
|
|
from .__run__ import run
|
2020-06-03 17:41:30 +00:00
|
|
|
|
2020-09-01 22:08:06 +00:00
|
|
|
run()
|
2020-06-03 17:41:30 +00:00
|
|
|
except SystemExit as exc:
|
2020-09-01 22:08:06 +00:00
|
|
|
if exc.code == ExitCodes.RESTART:
|
|
|
|
from .__run__ import run # reimport to load changes
|
|
|
|
run()
|
|
|
|
else:
|
|
|
|
raise exc
|
|
|
|
except Exception:
|
2020-08-28 21:05:04 +00:00
|
|
|
console.print_exception()
|
2020-06-03 17:41:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2020-08-27 23:06:57 +00:00
|
|
|
try:
|
|
|
|
main()
|
|
|
|
except Exception:
|
|
|
|
console.print_exception()
|