mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
feat: add os.copyToClipboardCmd to allow for a custom command
Issue #1055 test: CopyPatchToClipboard (temporary commit for review)
This commit is contained in:
parent
7e9f669421
commit
d7f84aed8a
6 changed files with 70 additions and 50 deletions
|
@ -267,6 +267,13 @@ func (c *OSCommand) CopyToClipboard(str string) error {
|
|||
escaped := strings.Replace(str, "\n", "\\n", -1)
|
||||
truncated := utils.TruncateWithEllipsis(escaped, 40)
|
||||
c.LogCommand(fmt.Sprintf("Copying '%s' to clipboard", truncated), false)
|
||||
if c.UserConfig.OS.CopyToClipboardCmd != "" {
|
||||
cmdStr := utils.ResolvePlaceholderString(c.UserConfig.OS.CopyToClipboardCmd, map[string]string{
|
||||
"text": c.Cmd.Quote(str),
|
||||
})
|
||||
return c.Cmd.NewShell(cmdStr).Run()
|
||||
}
|
||||
|
||||
return clipboard.WriteAll(str)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue