mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Add runCommand
function to Go template syntax
This makes it possible to use date and time in initial values like this: ```yaml initialValue: 'ruudk/{{ runCommand "date +\"%Y/%-m\"" }}/' ``` I want to use this to configure my BranchPrefix like this: ```yaml git: branchPrefix: 'ruudk/{{ runCommand "date +\"%Y/%-m\"" }}/' ```
This commit is contained in:
parent
c7feba9bb1
commit
12820481e6
8 changed files with 140 additions and 3 deletions
|
@ -246,7 +246,8 @@ func (self *HandlerCreator) getResolveTemplateFn(form map[string]string, promptR
|
|||
}
|
||||
|
||||
funcs := template.FuncMap{
|
||||
"quote": self.c.OS().Quote,
|
||||
"quote": self.c.OS().Quote,
|
||||
"runCommand": self.c.Git().Custom.TemplateFunctionRunCommand,
|
||||
}
|
||||
|
||||
return func(templateStr string) (string, error) { return utils.ResolveTemplate(templateStr, objects, funcs) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue