action/command: Allow multiple help pages to be opened

This commit is contained in:
Jöran Karl 2024-10-13 13:03:16 +02:00
parent 26f0806915
commit 2c62d4b70c
2 changed files with 11 additions and 8 deletions

View File

@ -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])
}
}
}

View File

@ -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.