aboutsummaryrefslogtreecommitdiff
path: root/tools/host_tools/FormatConverter/input.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/host_tools/FormatConverter/input.py')
-rw-r--r--tools/host_tools/FormatConverter/input.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/host_tools/FormatConverter/input.py b/tools/host_tools/FormatConverter/input.py
new file mode 100644
index 00000000..7a206273
--- /dev/null
+++ b/tools/host_tools/FormatConverter/input.py
@@ -0,0 +1,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 \ No newline at end of file