Initial draft
This commit is contained in:
23
src/matomo_bootstrap/__main__.py
Normal file
23
src/matomo_bootstrap/__main__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from .cli import parse_args
|
||||
from .bootstrap import run_bootstrap
|
||||
from .errors import BootstrapError
|
||||
import sys
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
|
||||
try:
|
||||
token = run_bootstrap(args)
|
||||
print(token)
|
||||
return 0
|
||||
except BootstrapError as exc:
|
||||
print(f"[ERROR] {exc}", file=sys.stderr)
|
||||
return 2
|
||||
except Exception as exc:
|
||||
print(f"[FATAL] {type(exc).__name__}: {exc}", file=sys.stderr)
|
||||
return 3
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user