aboutsummaryrefslogtreecommitdiff
path: root/tools/host_tools/FormatConverter/input.py
blob: 7a206273b7d6e3cd8a0b68dbb8e841f130c32a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys

def inputText():
	input = sys.stdin.readline()
	return input.strip()

def inputChoices(list, backcmd = "b", backtext = "back"):
	repeat = True
	while(repeat):
		repeat = False
		count = 0
		for item in list:
			print count, "-", item
			count += 1
		print backcmd, "-", backtext
		input = inputText()
		if input == backcmd:
			return None
		
		action = int(input)
		if action >= len(list):
			repeat = True
	return action