-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample_tui_app.py
More file actions
executable file
·53 lines (44 loc) · 1.3 KB
/
example_tui_app.py
File metadata and controls
executable file
·53 lines (44 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""
Simple example TUI application for testing the TUI MCP server.
This is a basic interactive menu application.
"""
import sys
def main():
print("=" * 60)
print(" Welcome to the Example TUI Application")
print("=" * 60)
print()
print("Please choose an option:")
print(" 1. Say Hello")
print(" 2. Show Info")
print(" 3. Counter")
print(" q. Quit")
print()
counter = 0
while True:
try:
choice = input("> ").strip().lower()
if choice == '1':
print("Hello, TUI Tester!")
print()
elif choice == '2':
print("This is an example TUI application.")
print("Created for testing the MCP TUI Test server.")
print()
elif choice == '3':
counter += 1
print(f"Counter value: {counter}")
print()
elif choice == 'q':
print("Goodbye!")
sys.exit(0)
else:
print(f"Unknown option: {choice}")
print("Please choose 1, 2, 3, or q")
print()
except (EOFError, KeyboardInterrupt):
print("\nGoodbye!")
sys.exit(0)
if __name__ == "__main__":
main()