From 11fcabc479b8a401c2189bed8f500db9af08cd47 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 4 Jun 2023 16:49:20 +0200 Subject: Add command to show --help for CLI commands --- .emacs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to '.emacs') diff --git a/.emacs b/.emacs index 3c2322d..545218b 100644 --- a/.emacs +++ b/.emacs @@ -205,6 +205,14 @@ (call-process-shell-command command nil t) (my/kill (buffer-string)))) +(defun my/shell-command-help (command) + (interactive + (list (read-shell-command "Show --help for: "))) + (let* ((command--help (concat command " --help")) + (help-buf (get-buffer-create (format "*%s*" command--help)))) + (shell-command (concat command--help) help-buf) + (display-buffer help-buf))) + (defun my/make-project-wide (f) "Make a function which will run F from the project's root directory." (lambda () @@ -266,7 +274,8 @@ (my/define-prefix-command my/manual-map "Keymap for reading manuals." - '(("i" info-display-manual) + '(("h" my/shell-command-help) + ("i" info-display-manual) ("m" man) ("s" shortdoc-display-group))) -- cgit v1.2.3