Run a git command (output excluded from chat)
(self, args)
| 955 | self.io.tool_output(f"Removed {matched_file} from the chat") |
| 956 | |
| 957 | def cmd_git(self, args): |
| 958 | "Run a git command (output excluded from chat)" |
| 959 | combined_output = None |
| 960 | try: |
| 961 | args = "git " + args |
| 962 | env = dict(subprocess.os.environ) |
| 963 | env["GIT_EDITOR"] = "true" |
| 964 | result = subprocess.run( |
| 965 | args, |
| 966 | stdout=subprocess.PIPE, |
| 967 | stderr=subprocess.STDOUT, |
| 968 | text=True, |
| 969 | env=env, |
| 970 | shell=True, |
| 971 | encoding=self.io.encoding, |
| 972 | errors="replace", |
| 973 | ) |
| 974 | combined_output = result.stdout |
| 975 | except Exception as e: |
| 976 | self.io.tool_error(f"Error running /git command: {e}") |
| 977 | |
| 978 | if combined_output is None: |
| 979 | return |
| 980 | |
| 981 | self.io.tool_output(combined_output) |
| 982 | |
| 983 | def cmd_test(self, args): |
| 984 | "Run a shell command and add the output to the chat on non-zero exit code" |