gitarsenal-cli 1.4.7 ā 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -4096,9 +4096,13 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
4096
4096
|
|
4097
4097
|
def prompt_for_gpu():
|
4098
4098
|
"""
|
4099
|
-
Prompt the user to select a GPU type from available options.
|
4099
|
+
Prompt the user to select a GPU type from available options using arrow keys.
|
4100
4100
|
Returns the selected GPU type.
|
4101
4101
|
"""
|
4102
|
+
import sys
|
4103
|
+
import tty
|
4104
|
+
import termios
|
4105
|
+
|
4102
4106
|
# Define available GPU types and their specifications
|
4103
4107
|
gpu_specs = {
|
4104
4108
|
'T4': {'gpu': 'T4', 'memory': '16GB'},
|
@@ -4112,47 +4116,103 @@ def prompt_for_gpu():
|
|
4112
4116
|
'B200': {'gpu': 'B200', 'memory': '141GB'}
|
4113
4117
|
}
|
4114
4118
|
|
4115
|
-
|
4116
|
-
|
4117
|
-
|
4118
|
-
print("āāāāāāāāāāāāāāā¼āāāāāāāāāāā¤")
|
4119
|
-
|
4120
|
-
# Create a list to keep track of valid options
|
4121
|
-
options = []
|
4119
|
+
# Create a list of options
|
4120
|
+
options = list(gpu_specs.keys())
|
4121
|
+
selected_index = 2 # Default to A10G (index 2)
|
4122
4122
|
|
4123
|
-
|
4124
|
-
|
4125
|
-
|
4126
|
-
|
4123
|
+
def get_key():
|
4124
|
+
"""Get a single keypress from the user."""
|
4125
|
+
fd = sys.stdin.fileno()
|
4126
|
+
old_settings = termios.tcgetattr(fd)
|
4127
|
+
try:
|
4128
|
+
tty.setraw(sys.stdin.fileno())
|
4129
|
+
ch = sys.stdin.read(1)
|
4130
|
+
if ch == '\x1b': # Escape sequence
|
4131
|
+
ch2 = sys.stdin.read(1)
|
4132
|
+
if ch2 == '[':
|
4133
|
+
ch3 = sys.stdin.read(1)
|
4134
|
+
if ch3 == 'A':
|
4135
|
+
return 'UP'
|
4136
|
+
elif ch3 == 'B':
|
4137
|
+
return 'DOWN'
|
4138
|
+
elif ch == '\r' or ch == '\n':
|
4139
|
+
return 'ENTER'
|
4140
|
+
elif ch == '\x03': # Ctrl+C
|
4141
|
+
return 'CTRL_C'
|
4142
|
+
return ch
|
4143
|
+
finally:
|
4144
|
+
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
4145
|
+
|
4146
|
+
def display_menu():
|
4147
|
+
"""Display the GPU selection menu with current selection highlighted."""
|
4148
|
+
print("\nš Available GPU Options:")
|
4149
|
+
print("āāāāāāāāāāāāāāā¬āāāāāāāāāāā")
|
4150
|
+
print("ā GPU Type ā Memory ā")
|
4151
|
+
print("āāāāāāāāāāāāāāā¼āāāāāāāāāāā¤")
|
4152
|
+
|
4153
|
+
for i, gpu_type in enumerate(options):
|
4154
|
+
specs = gpu_specs[gpu_type]
|
4155
|
+
# Calculate proper spacing for alignment
|
4156
|
+
number_part = f"{i+1}."
|
4157
|
+
if i == selected_index:
|
4158
|
+
prefix = "> "
|
4159
|
+
suffix = " ā"
|
4160
|
+
else:
|
4161
|
+
prefix = " "
|
4162
|
+
suffix = ""
|
4163
|
+
|
4164
|
+
# Ensure consistent width for GPU type column
|
4165
|
+
gpu_display = f"{prefix}{number_part} {gpu_type}"
|
4166
|
+
gpu_padded = f"{gpu_display:<12}" # Fixed width for GPU column
|
4167
|
+
|
4168
|
+
print(f"ā {gpu_padded} ā {specs['memory']:<7} ā{suffix}")
|
4169
|
+
|
4170
|
+
print("āāāāāāāāāāāāāāā“āāāāāāāāāāā")
|
4171
|
+
print("Use ā/ā arrows to select, Enter to confirm, Ctrl+C to cancel")
|
4127
4172
|
|
4128
|
-
|
4173
|
+
# Clear screen and show initial menu
|
4174
|
+
print("\033[2J\033[H", end="") # Clear screen and move cursor to top
|
4175
|
+
display_menu()
|
4129
4176
|
|
4130
|
-
# Prompt for selection
|
4131
4177
|
while True:
|
4132
4178
|
try:
|
4133
|
-
|
4179
|
+
key = get_key()
|
4134
4180
|
|
4135
|
-
|
4136
|
-
|
4137
|
-
|
4138
|
-
|
4139
|
-
|
4140
|
-
|
4141
|
-
|
4142
|
-
|
4143
|
-
|
4144
|
-
|
4145
|
-
|
4146
|
-
|
4147
|
-
elif
|
4148
|
-
|
4149
|
-
|
4150
|
-
|
4181
|
+
if key == 'UP':
|
4182
|
+
selected_index = (selected_index - 1) % len(options)
|
4183
|
+
print("\033[2J\033[H", end="") # Clear screen
|
4184
|
+
display_menu()
|
4185
|
+
elif key == 'DOWN':
|
4186
|
+
selected_index = (selected_index + 1) % len(options)
|
4187
|
+
print("\033[2J\033[H", end="") # Clear screen
|
4188
|
+
display_menu()
|
4189
|
+
elif key == 'ENTER':
|
4190
|
+
selected_gpu = options[selected_index]
|
4191
|
+
print(f"\nā
Selected GPU: {selected_gpu}")
|
4192
|
+
return selected_gpu
|
4193
|
+
elif key == 'CTRL_C':
|
4194
|
+
print("\nš Selection cancelled.")
|
4195
|
+
sys.exit(1)
|
4196
|
+
|
4151
4197
|
except KeyboardInterrupt:
|
4152
4198
|
print("\nš Selection cancelled.")
|
4153
4199
|
sys.exit(1)
|
4154
4200
|
except Exception as e:
|
4155
|
-
print(f"ā Error: {e}")
|
4201
|
+
print(f"\nā Error: {e}")
|
4202
|
+
# Fall back to simple input method
|
4203
|
+
try:
|
4204
|
+
choice = input("\nš Select GPU type (number or name, default is A10G): ").strip()
|
4205
|
+
if not choice:
|
4206
|
+
return "A10G"
|
4207
|
+
if choice.isdigit():
|
4208
|
+
index = int(choice) - 1
|
4209
|
+
if 0 <= index < len(options):
|
4210
|
+
return options[index]
|
4211
|
+
elif choice in options:
|
4212
|
+
return choice
|
4213
|
+
return "A10G"
|
4214
|
+
except:
|
4215
|
+
return "A10G"
|
4156
4216
|
|
4157
4217
|
# Replace the existing GPU argument parsing in the main section
|
4158
4218
|
if __name__ == "__main__":
|