Add main() method handling click standalone_mode=False
+import sys
from functools import wraps
from os import environ
import click
+from click import Abort
+from click.exceptions import ClickException, Exit
from plextraktsync.factory import factory
@@ -323,3 +326,18 @@ def config():
cli.add_command(unmatched)
cli.add_command(watch)
cli.add_command(watched_shows)
+
+
+def main():
+ try:
+ exit_code = cli(standalone_mode=False)
+ except ClickException as e:
+ e.show()
+ sys.exit(e.exit_code)
+ except Abort:
+ print("Aborted!")
+ sys.exit(1)
+ except Exit as e:
+ raise ClickException(f"Exited with {e.exit_code}.")
+
+ sys.exit(exit_code)
