Allow getting the last non-empty command output easily via an action or remote control

Fixes #4973
This commit is contained in:
Kovid Goyal
2022-05-28 15:19:24 +05:30
parent 4c74462763
commit 0509855930
6 changed files with 63 additions and 6 deletions

View File

@@ -164,7 +164,7 @@ class DynamicColor(IntEnum):
class CommandOutput(IntEnum):
last_run, first_on_screen, last_visited = 0, 1, 2
last_run, first_on_screen, last_visited, last_non_empty = 0, 1, 2, 3
DYNAMIC_COLOR_CODES = {
@@ -1460,6 +1460,14 @@ class Window:
def show_last_visited_command_output(self) -> None:
self.show_cmd_output(CommandOutput.last_visited, 'Last visited command output')
@ac('cp', '''
Show the last non-empty output from a shell command in a pager like less
Requires :ref:`shell_integration` to work
''')
def show_last_non_empty_command_output(self) -> None:
self.show_cmd_output(CommandOutput.last_non_empty, 'Last non-empty command output')
@ac('cp', 'Paste the specified text into the current window')
def paste(self, text: str) -> None:
self.paste_with_actions(text)