Skip to content

Commit 1769a8f

Browse files
committed
F1 shows man page for current command
1 parent 8cc22b9 commit 1769a8f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pgcli/key_bindings.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import os
23
from prompt_toolkit.enums import EditingMode
34
from prompt_toolkit.key_binding import KeyBindings
45
from prompt_toolkit.filters import (
@@ -20,6 +21,14 @@ def pgcli_bindings(pgcli):
2021

2122
tab_insert_text = " " * 4
2223

24+
@kb.add("f1")
25+
def _(event):
26+
"""Show man page for current command."""
27+
_logger.debug("Detected <F1> key.")
28+
29+
t = event.app.current_buffer.text
30+
os.system(f"man {t}")
31+
2332
@kb.add("f2")
2433
def _(event):
2534
"""Enable/Disable SmartCompletion Mode."""

0 commit comments

Comments
 (0)