From 2c62d4b70c3621d1a459687d48ba450bb80e79ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6ran=20Karl?= <3951388+JoeKar@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:03:16 +0200 Subject: [PATCH] action/command: Allow multiple `help` pages to be opened --- internal/action/command.go | 14 ++++++++------ runtime/help/commands.md | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/internal/action/command.go b/internal/action/command.go index 9192e1dc..3c14dea2 100644 --- a/internal/action/command.go +++ b/internal/action/command.go @@ -488,13 +488,15 @@ func (h *BufPane) HelpCmd(args []string) { forceSplit = true } - if config.FindRuntimeFile(config.RTHelp, topics[0]) != nil { - err := h.openHelp(topics[0], hsplit, forceSplit) - if err != nil { - InfoBar.Error(err) + for _, topic := range topics { + if config.FindRuntimeFile(config.RTHelp, topic) != nil { + err := h.openHelp(topic, hsplit, forceSplit) + if err != nil { + InfoBar.Error(err) + } + } else { + InfoBar.Error("Sorry, no help for ", topic) } - } else { - InfoBar.Error("Sorry, no help for ", topics[0]) } } } diff --git a/runtime/help/commands.md b/runtime/help/commands.md index b62a40b1..7d71d785 100644 --- a/runtime/help/commands.md +++ b/runtime/help/commands.md @@ -21,8 +21,9 @@ quotes here but these are not necessary when entering the command in micro. This command will modify `bindings.json` and overwrite any bindings to `key` that already exist. -* `help ['topic'] ['flags']`: opens the corresponding help topic. - If no topic is provided opens the default help screen. +* `help ['topic'] ['flags']`: opens the corresponding help topics. + If no topic is provided opens the default help screen. If multiple topics are + provided (separated via ` `) they are opened all as splits. Help topics are stored as `.md` files in the `runtime/help` directory of the source tree, which is embedded in the final binary. The `flags` are optional.