mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
refactor: Express WithGpgHelper with a config key parameter
This commit is contained in:
parent
6fb3b7430c
commit
f779a5878d
5 changed files with 28 additions and 10 deletions
|
@ -57,16 +57,27 @@ func (self *ConfigCommands) GetPager(width int) string {
|
|||
return utils.ResolvePlaceholderString(pagerTemplate, templateValues)
|
||||
}
|
||||
|
||||
// NeedsGpgSubprocessForCommit tells us whether the user has gpg enabled for commit actions
|
||||
type GpgConfigKey string
|
||||
|
||||
const (
|
||||
CommitGpgSign GpgConfigKey = "commit.gpgSign"
|
||||
TagGpgSign GpgConfigKey = "tag.gpgSign"
|
||||
)
|
||||
|
||||
// NeedsGpgSubprocess tells us whether the user has gpg enabled for the specified action type
|
||||
// and needs a subprocess because they have a process where they manually
|
||||
// enter their password every time a GPG action is taken
|
||||
func (self *ConfigCommands) NeedsGpgSubprocessForCommit() bool {
|
||||
func (self *ConfigCommands) NeedsGpgSubprocess(key GpgConfigKey) bool {
|
||||
overrideGpg := self.UserConfig().Git.OverrideGpg
|
||||
if overrideGpg {
|
||||
return false
|
||||
}
|
||||
|
||||
return self.gitConfig.GetBool("commit.gpgSign")
|
||||
return self.gitConfig.GetBool(string(key))
|
||||
}
|
||||
|
||||
func (self *ConfigCommands) NeedsGpgSubprocessForCommit() bool {
|
||||
return self.NeedsGpgSubprocess(CommitGpgSign)
|
||||
}
|
||||
|
||||
func (self *ConfigCommands) GetCoreEditor() string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue