MCPcopy Create free account
hub / github.com/codingmoh/open-codex / print_response

Function print_response

src/open_codex/main.py:31–55  ·  view source on GitHub ↗
(command: str)

Source from the content-addressed store, hash-verified

29 return key
30
31def print_response(command: str):
32 print(f"{BLUE}Command found:\n=====================")
33 print(f"{GREEN}{command}{RESET}")
34 print(f"{BLUE}====================={RESET}")
35 print(f"{BLUE}What do you want to do with this command?{RESET}")
36 print(f"{BLUE}[c] Copy [e] Execute [a] Abort{RESET}")
37 print(f"{BLUE}Press key: ", end="", flush=True)
38
39 choice = get_keypress().lower()
40 print(f"{RESET}")
41
42 if choice == "e":
43 print(f"{BLUE}Executing command: {command}{RESET}")
44 result = subprocess.run(command, shell=True, capture_output=True, text=True)
45 print(f"{GREEN}Command output: {result.stdout}{RESET}")
46 if result.stderr:
47 print(f"{RED}Error: {result.stderr}{RESET}")
48 elif choice == "c":
49 import pyperclip # ⏱ lazy import
50 pyperclip.copy(command)
51 print(f"{GREEN}Command copied to clipboard!{RESET}")
52 elif choice == "a":
53 print(f"{BLUE}Aborted.{RESET}")
54 else:
55 print(f"{RED}Unknown choice. Nothing happened.{RESET}")
56
57def one_shot_mode(prompt: str):
58 from open_codex.agent_builder import AgentBuilder

Callers 1

one_shot_modeFunction · 0.85

Calls 1

get_keypressFunction · 0.85

Tested by

no test coverage detected