From 1769a8f25f50a215875a8804b689e0214287ba5b Mon Sep 17 00:00:00 2001 From: Serpent7776 Date: Sat, 6 Apr 2024 14:25:48 +0200 Subject: [PATCH] F1 shows man page for current command --- pgcli/key_bindings.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pgcli/key_bindings.py b/pgcli/key_bindings.py index 9c016f7ff..66c1abcff 100644 --- a/pgcli/key_bindings.py +++ b/pgcli/key_bindings.py @@ -1,4 +1,5 @@ import logging +import os from prompt_toolkit.enums import EditingMode from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.filters import ( @@ -20,6 +21,14 @@ def pgcli_bindings(pgcli): tab_insert_text = " " * 4 + @kb.add("f1") + def _(event): + """Show man page for current command.""" + _logger.debug("Detected key.") + + t = event.app.current_buffer.text + os.system(f"man {t}") + @kb.add("f2") def _(event): """Enable/Disable SmartCompletion Mode."""