コード例 #1
0
def getHostFromUser():
    terminal.clear()
    print("What is the host name (" + interface.getHost()[0] + ")?")
    newhost = terminal.getInput(">> ")
    if (newhost == ""):
        newhost = interface.getHost()[0]
    return newhost
コード例 #2
0
def getPortFromUser():
    terminal.clear()
    print("What is the host port (" + str(interface.getHost()[1]) + ")?")
    newport = terminal.getInput(">> ")
    if (newport == ""):
        newport = interface.getHost()[1]
    else:
        newport = int(newport)
    return newport
コード例 #3
0
def getUserNameFromUser():
    userName = ""
    while (userName == "" or userName[0:5] == "sudo,"):
        print("What is your name?")
        userName = terminal.getInput(">> ")
        terminal.clear()

        # If it is a sudo command, do it
        if (userName[0:5] == "sudo,"):
            handleSudoCommand(userName[6:])

    return userName
コード例 #4
0
def exitWhenUserReady():
    printErrors()
    terminal.getInput("Press any key to continue...")