jesseduffield / jesseduffield/lazygit

Add escape support to templates for custom commands

Open
#5,893 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

### Is your feature request related to a problem? Please describe.
sometimes in a template `| quote` isn't enough, for example
`command: 'git commit --message "{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message }}"'` will break if .Form.Message contains `"`

### Describe the solution you'd like
like we have `| quote` would be nice to have `| escape` or something similar (maybe a replace?) so we can escape quotes

### Describe alternatives you've considered
Alternatively, something like [sprig](https://masterminds.github.io/sprig/) could be useful

### Additional context

Contributor guide

Open the contributing guide

Research direction

Start by tracing how lazygit parses templates for custom commands and where the existing `quote` function is registered or tested. Define the intended behavior for an `escape`-style helper, especially when the message contains quotes, then add coverage showing that the rendered command remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.