Skip to content

Commit 2c62d4b

Browse files
committed
action/command: Allow multiple help pages to be opened
1 parent 26f0806 commit 2c62d4b

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

internal/action/command.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,13 +488,15 @@ func (h *BufPane) HelpCmd(args []string) {
488488
forceSplit = true
489489
}
490490

491-
if config.FindRuntimeFile(config.RTHelp, topics[0]) != nil {
492-
err := h.openHelp(topics[0], hsplit, forceSplit)
493-
if err != nil {
494-
InfoBar.Error(err)
491+
for _, topic := range topics {
492+
if config.FindRuntimeFile(config.RTHelp, topic) != nil {
493+
err := h.openHelp(topic, hsplit, forceSplit)
494+
if err != nil {
495+
InfoBar.Error(err)
496+
}
497+
} else {
498+
InfoBar.Error("Sorry, no help for ", topic)
495499
}
496-
} else {
497-
InfoBar.Error("Sorry, no help for ", topics[0])
498500
}
499501
}
500502
}

runtime/help/commands.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ quotes here but these are not necessary when entering the command in micro.
2121
This command will modify `bindings.json` and overwrite any bindings to
2222
`key` that already exist.
2323

24-
* `help ['topic'] ['flags']`: opens the corresponding help topic.
25-
If no topic is provided opens the default help screen.
24+
* `help ['topic'] ['flags']`: opens the corresponding help topics.
25+
If no topic is provided opens the default help screen. If multiple topics are
26+
provided (separated via ` `) they are opened all as splits.
2627
Help topics are stored as `.md` files in the `runtime/help` directory of
2728
the source tree, which is embedded in the final binary.
2829
The `flags` are optional.

0 commit comments

Comments
 (0)