style: Improve code formatting and readability

This commit is contained in:
Paul Gauthier (aider) 2024-09-27 14:26:56 -07:00
parent f95c4626cf
commit 114fb2a889

View file

@ -1172,11 +1172,17 @@ class Commands:
try:
pyperclip.copy(last_assistant_message)
preview = last_assistant_message[:50] + "..." if len(last_assistant_message) > 50 else last_assistant_message
preview = (
last_assistant_message[:50] + "..."
if len(last_assistant_message) > 50
else last_assistant_message
)
self.io.tool_output(f"Copied last assistant message to clipboard. Preview: {preview}")
except pyperclip.PyperclipException as e:
self.io.tool_error(f"Failed to copy to clipboard: {str(e)}")
self.io.tool_output("You may need to install xclip or xsel on Linux, or pbcopy on macOS.")
self.io.tool_output(
"You may need to install xclip or xsel on Linux, or pbcopy on macOS."
)
except Exception as e:
self.io.tool_error(f"An unexpected error occurred while copying to clipboard: {str(e)}")