diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-05-19 20:43:22 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-05-20 21:02:49 +0200 |
commit | 22a38c9f5026c4b23d8288ef194235dfe52b03e3 (patch) | |
tree | 40ac91f412ff14861c1312ac8d20204af212508d /pkg/gui/services/custom_commands | |
parent | 6343fb57d605a488f4d3ff6cd1f13341307b6159 (diff) |
Add property outputTitle to CustomCommand
It can optionally be used to set the title of the panel that shows the output of
a command (when showOutput is true). If left unset, the command string is used
as the title.
Diffstat (limited to 'pkg/gui/services/custom_commands')
-rw-r--r-- | pkg/gui/services/custom_commands/handler_creator.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg/gui/services/custom_commands/handler_creator.go b/pkg/gui/services/custom_commands/handler_creator.go index 9a127f362..c1cfe09cb 100644 --- a/pkg/gui/services/custom_commands/handler_creator.go +++ b/pkg/gui/services/custom_commands/handler_creator.go @@ -292,7 +292,15 @@ func (self *HandlerCreator) finalHandler(customCommand config.CustomCommand, ses if strings.TrimSpace(output) == "" { output = self.c.Tr.EmptyOutput } - return self.c.Alert(cmdStr, output) + + title := cmdStr + if customCommand.OutputTitle != "" { + title, err = resolveTemplate(customCommand.OutputTitle) + if err != nil { + return err + } + } + return self.c.Alert(title, output) } return nil |