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.
This commit is contained in:
Stefan Haller 2024-05-19 20:43:22 +02:00
parent 6343fb57d6
commit 22a38c9f50
6 changed files with 74 additions and 1 deletions

View file

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