def get_parser():
    if len(sys.argv) == 1 and not is_local_installation():
        sys.argv.append('start')

    # Init parser
    description = 'Start script for OpenSlides.'
    if 'manage.py' not in sys.argv[0]:
        description += """
            If it is called without any argument, this will be treated as
            if it is called with the 'start' subcommand. That means
            OpenSlides will setup default settings and database, start the
            tornado webserver, launch the default web browser and open the
            webinterface.
            """
    epilog = """
        There are some more subcommands available. They belong to Django's
        command-line utility for administrative tasks. Type '%(prog)s help'
        (without the two hyphen-minus characters) to list them all. Type
        '%(prog)s help <subcommand>' for help on a specific subcommand.
        """
    parser = ExceptionArgumentParser(
        description=description,
        epilog=epilog)

    # Add version argument
    parser.add_argument(
        '--version',
        action='version',
        version=openslides_version,
        help='Show version number and exit.')

    # Init subparsers
    subparsers = parser.add_subparsers(
        dest='subcommand',
        title='Available subcommands',
        description="Type '%s <subcommand> --help' for help on a "
                    "specific subcommand." % parser.prog,
        help='You can choose only one subcommand at once.',
        metavar='')

    # Subcommand start
    start_help = (
        'Setup settings and database, start tornado webserver, launch the '
        'default web browser and open the webinterface. The environment '
        'variable DJANGO_SETTINGS_MODULE is ignored.')
    subcommand_start = subparsers.add_parser(
        'start',
        description=start_help,
        help=start_help)
    subcommand_start.add_argument(
        '--no-browser',
        action='store_true',
        help='Do not launch the default web browser.')
    subcommand_start.add_argument(
        '--host',
        action='store',
        default='0.0.0.0',
        help='IP address to listen on. Default is 0.0.0.0.')
    subcommand_start.add_argument(
        '--port',
        action='store',
        default='8000',
        help='Port to listen on. Default is 8000.')
    subcommand_start.add_argument(
        '--settings_path',
        action='store',
        default=None,
        help='The used settings file. The file is created, if it does not exist.')
    subcommand_start.set_defaults(callback=start)
    subcommand_start.add_argument(
        '--local-installation',
        action='store_true',
        help='Store settings and user files in a local directory.')

    # Subcommand createsettings
    createsettings_help = 'Creates the settings file.'
    subcommand_createsettings = subparsers.add_parser(
        'createsettings',
        description=createsettings_help,
        help=createsettings_help)
    subcommand_createsettings.set_defaults(callback=createsettings)
    subcommand_createsettings.add_argument(
        '--settings_path',
        action='store',
        default=None,
        help='The used settings file. The file is created, even if it exists.')
    subcommand_createsettings.add_argument(
        '--local-installation',
        action='store_true',
        help='Store settings and user files in a local directory.')

    # Help text for several Django subcommands
    django_subcommands = (
        ('backupdb', 'Backups the SQLite3 database.'),
        ('createsuperuser', 'Creates or resets the admin user.'),
        ('migrate', 'Updates database schema.'),
        ('runserver', 'Starts the Tornado webserver.'),
    )
    for django_subcommand, help_text in django_subcommands:
        subparsers._choices_actions.append(
            subparsers._ChoicesPseudoAction(
                django_subcommand,
                (),
                help_text))

    return parser
Parses all command line arguments.
dataset/ETHPy150Open OpenSlides/OpenSlides/openslides/__main__.py/get_parser