mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
Add action to copy the last command output
This commit is contained in:
committed by
Kovid Goyal
parent
8cf05896ce
commit
e29a374e04
@@ -2131,6 +2131,16 @@ class Window:
|
||||
def show_last_non_empty_command_output(self) -> None:
|
||||
self.show_cmd_output(CommandOutput.last_non_empty, 'Last non-empty command output')
|
||||
|
||||
@ac('cp', '''
|
||||
Copy the last non-empty output from a shell command to the clipboard
|
||||
|
||||
Requires :ref:`shell_integration` to work
|
||||
''')
|
||||
def copy_last_command_output(self) -> None:
|
||||
text = self.cmd_output(CommandOutput.last_non_empty, as_ansi=False, add_wrap_markers=False)
|
||||
if text:
|
||||
set_clipboard_string(text)
|
||||
|
||||
@ac('cp', 'Paste the specified text into the current window. ANSI C escapes are decoded.')
|
||||
def paste(self, text: str) -> None:
|
||||
self.paste_with_actions(text)
|
||||
|
||||
Reference in New Issue
Block a user