mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-25 18:37:50 +00:00
Add action to copy the last command output
This commit is contained in:
parent
8cf05896ce
commit
e29a374e04
1 changed files with 10 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue