feat: Implement 'clear' command in terminal
Add functionality to clear the terminal output history when the user enters 'clear' or 'cls'. This improves the usability of the terminal feature by allowing users to easily reset the display.
This commit is contained in:
parent
22a278f748
commit
8d13bb3963
@ -237,8 +237,14 @@ class TerminalCog(commands.Cog, name="Terminal"):
|
||||
await interaction.response.send_message("Terminal session is not active. Use `/terminal` to start.", ephemeral=True)
|
||||
return
|
||||
|
||||
# Add command to history (before execution)
|
||||
self.output_history.append(f"{self.current_cwd}> {command}")
|
||||
|
||||
# Handle 'clear' command separately
|
||||
if command.strip().lower() == "clear" or command.strip().lower() == "cls":
|
||||
self.output_history.clear()
|
||||
self.output_history.append(f"{self.current_cwd}> ") # Add new prompt
|
||||
self.scroll_offset = 0 # Reset scroll
|
||||
await self._update_terminal_message(interaction)
|
||||
return
|
||||
|
||||
# Handle 'cd' command separately
|
||||
if command.strip().lower().startswith("cd "):
|
||||
|
Loading…
x
Reference in New Issue
Block a user