summaryrefslogtreecommitdiff
path: root/.emacs
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2023-06-04 16:49:20 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2023-06-04 16:54:10 +0200
commit11fcabc479b8a401c2189bed8f500db9af08cd47 (patch)
tree552aea1f36c945353c42be745331cce0eeef2bca /.emacs
parent99dbb07618bf017fb66f457994d5ab0aa39c4eea (diff)
downloaddotfiles-11fcabc479b8a401c2189bed8f500db9af08cd47.tar.xz
Add command to show --help for CLI commands
Diffstat (limited to '.emacs')
-rw-r--r--.emacs11
1 files changed, 10 insertions, 1 deletions
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)))