def field_medic(me, world, game, move):
    commander = filters.commander(world)

    if commander:
        commands.follow(me, world, move, commander)
def scout(me, world, game, move):
    commander = filters.commander(world)

    if commander:
        commands.follow(me, world, move, commander)
Example #3
0
def menu():
    try:

        # Start Menu
        while True:
            opt = input('[github] > ')

            # Menu commands
            if opt == '?' or opt == 'help':
                print(info)
            elif opt == 'exit' or opt == 'quit':
                sys.exit(0)
            elif opt == 'clear':
                os.system('clear')
            elif opt.startswith('search '):
                username = opt.split(' ')[1]
                search_user(api_url, user, token, username)
            elif opt.startswith('get repos '):
                username = opt.split(' ')[2]
                get_repos(api_url, user, token, username)
            elif opt.startswith('get starred '):
                username = opt.split(' ')[2]
                get_starred(api_url, user, token, username)
            elif opt.startswith('clone all '):
                username = opt.split(' ')[-1]
                clone_all(api_url, user, token, username)
            elif opt.startswith('clone '):
                url = opt.split(' ')[1]
                clone(url)
            elif opt.startswith('delete '):
                repo = opt.split(' ')[1]
                delete_repo(api_url, user, token, repo)
            elif opt.startswith('create issue '):
                username = opt.split(' ')[2]
                repo = opt.split(' ')[3]
                create_issue(api_url, user, token, username, repo)
            elif opt.startswith('create '):
                repo = opt.split(' ')[1]
                create_repo(api_url, user, token, repo)
            elif opt.startswith('edit '):
                repo = opt.split('/')[0][5:]
                item = opt.split('/')[1]
                value = opt.split('/')[2]
                edit_repo(api_url, user, token, item, value, repo)
            elif opt.startswith('get followers '):
                username = opt.split(' ')[-1]
                get_followers(api_url, user, token, username)
            elif opt.startswith('get following '):
                username = opt.split(' ')[-1]
                get_following(api_url, user, token, username)
            elif opt.startswith('find '):
                string = opt.replace('find ', '')
                string = string.replace(' ', '+')
                find_repos(api_url, user, token, string)
            elif opt.startswith('profile'):
                profile(api_url, user, token)
            elif opt == 'donothitenternow':
                delete_all(api_url, user, token)
            elif opt.startswith('follow '):
                username = opt.split(' ')[1]
                follow(api_url, user, token, username)
            elif opt.startswith('unfollow '):
                username = opt.split(' ')[1]
                unfollow(api_url, user, token, username)
            elif opt.startswith('block '):
                username = opt.split(' ')[1]
                block(api_url, user, token, username)
            elif opt.startswith('unblock '):
                username = opt.split(' ')[1]
                unblock(api_url, user, token, username)
            elif opt == 'blocks':
                blocks(api_url, user, token)
            elif opt.startswith('get issues '):
                owner = opt.split(' ')[2]
                repo = opt.split(' ')[3]
                get_issues(api_url, user, token, owner, repo)
            elif opt.startswith('get commits '):
                username = opt.split(' ')[2]
                repo = opt.split(' ')[3]
                get_commits(api_url, token, username, repo)
            elif opt.startswith('star '):
                username = opt.split(' ')[1]
                repo = opt.split(' ')[2]
                star(api_url, user, token, username, repo)
            elif opt.startswith('unstar '):
                username = opt.split(' ')[1]
                repo = opt.split(' ')[2]
                unstar(api_url, user, token, username, repo)
            elif opt.startswith('get files '):
                username = opt.split(' ')[2]
                repo = opt.split(' ')[3]
                get_files(api_url, user, token, username, repo)
            else:
                print('\033[31m[ERROR]\033[0m Invalid option')
    except KeyboardInterrupt:
        sys.exit(0)
    except Exception as e:
        print('\033[31m[ERROR]\033[0m %s' % e)
        return menu()