# -*- coding: utf-8 -*-

# -----------------------------------------------------------------------------
# Copyright 2016 Anaconda, Inc.
#
# May be copied and distributed freely only as part of an Anaconda or
# Miniconda installation.
# -----------------------------------------------------------------------------

"""Application entry point."""

from __future__ import annotations

__all__ = ['main']

import argparse
import sys
import typing

from navigator_updater import __version__
from navigator_updater.app.cli import parse_arguments
from navigator_updater.app.start import start_app
from navigator_updater.utils import logs


def main() -> typing.NoReturn:  # pragma: no cover
    """Main application entry point."""
    options: argparse.Namespace = parse_arguments()

    # Return information on version
    if options.version:
        print(__version__)
        sys.exit(0)

    # Clean old style logs
    logs.clean_logs()

    # Launch application
    start_app(options)


if __name__ == '__main__':  # pragma: no cover
    main()
