Ejemplo n.º 1
0
def run():
    print('****************** Hello Cinephile ******************')
    print()

    show_commands()

    while True:
        action = primary_func.get_action()

        with switch(action) as s:
            s.case('c', create_account)
            s.case('l', log_into_account)
            s.case('o', logout)
            s.case('s', list_movies)
            s.case('n', browse_by_location)
            s.case('t', browse_by_category)
            s.case('r', purchase_ticket)
            s.case('v', view_ticket)
            s.case('m', lambda: 'change_mode')
            s.case(['x', 'bye', 'exit', 'exit()'], secondary_func.exit_app)

            s.default(secondary_func.unknown_command)

        if action:
            print()

        if s.result == 'change_mode':
            return
Ejemplo n.º 2
0
def run():
    print('****************** Hello Theater Owner ******************')
    print()

    show_commands()

    while True:
        action = primary_func.get_action()

        with switch(action) as s:
            s.case('c', create_account)
            s.case('l', log_into_account)
            s.case('o', logout)
            s.case('p', create_movie)
            s.case('h', create_theater)
            s.case('e', add_movie_to_existing_theater)
            s.case('s', add_schedule_to_existing_theater)
            s.case('a', create_actor)
            s.case('m', lambda: 'change_mode')
            s.case(['x', 'bye', 'exit', 'exit()'], secondary_func.exit_app)

            s.default(secondary_func.unknown_command)

        if action:
            print()

        if s.result == 'change_mode':
            return