mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Add config os.shellFunctionsFile
This commit is contained in:
parent
41e9335ea8
commit
dc48cf963a
10 changed files with 75 additions and 24 deletions
|
@ -35,11 +35,12 @@ type OSCommand struct {
|
|||
|
||||
// Platform stores the os state
|
||||
type Platform struct {
|
||||
OS string
|
||||
Shell string
|
||||
ShellArg string
|
||||
OpenCommand string
|
||||
OpenLinkCommand string
|
||||
OS string
|
||||
Shell string
|
||||
ShellArg string
|
||||
PrefixForShellFunctionsFile string
|
||||
OpenCommand string
|
||||
OpenLinkCommand string
|
||||
}
|
||||
|
||||
// NewOSCommand os command runner
|
||||
|
@ -90,7 +91,7 @@ func (c *OSCommand) OpenFile(filename string) error {
|
|||
"filename": c.Quote(filename),
|
||||
}
|
||||
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
||||
return c.Cmd.NewShell(command).Run()
|
||||
return c.Cmd.NewShell(command, c.UserConfig().OS.ShellFunctionsFile).Run()
|
||||
}
|
||||
|
||||
func (c *OSCommand) OpenLink(link string) error {
|
||||
|
@ -107,7 +108,7 @@ func (c *OSCommand) OpenLink(link string) error {
|
|||
}
|
||||
|
||||
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
|
||||
return c.Cmd.NewShell(command).Run()
|
||||
return c.Cmd.NewShell(command, c.UserConfig().OS.ShellFunctionsFile).Run()
|
||||
}
|
||||
|
||||
// Quote wraps a message in platform-specific quotation marks
|
||||
|
@ -296,7 +297,7 @@ func (c *OSCommand) CopyToClipboard(str string) error {
|
|||
cmdStr := utils.ResolvePlaceholderString(c.UserConfig().OS.CopyToClipboardCmd, map[string]string{
|
||||
"text": c.Cmd.Quote(str),
|
||||
})
|
||||
return c.Cmd.NewShell(cmdStr).Run()
|
||||
return c.Cmd.NewShell(cmdStr, c.UserConfig().OS.ShellFunctionsFile).Run()
|
||||
}
|
||||
|
||||
return clipboard.WriteAll(str)
|
||||
|
@ -307,7 +308,7 @@ func (c *OSCommand) PasteFromClipboard() (string, error) {
|
|||
var err error
|
||||
if c.UserConfig().OS.CopyToClipboardCmd != "" {
|
||||
cmdStr := c.UserConfig().OS.ReadFromClipboardCmd
|
||||
s, err = c.Cmd.NewShell(cmdStr).RunWithOutput()
|
||||
s, err = c.Cmd.NewShell(cmdStr, c.UserConfig().OS.ShellFunctionsFile).RunWithOutput()
|
||||
} else {
|
||||
s, err = clipboard.ReadAll()
|
||||
}
|
||||
|
@ -357,5 +358,5 @@ func (c *OSCommand) UpdateWindowTitle() error {
|
|||
return getWdErr
|
||||
}
|
||||
argString := fmt.Sprint("title ", filepath.Base(path), " - Lazygit")
|
||||
return c.Cmd.NewShell(argString).Run()
|
||||
return c.Cmd.NewShell(argString, c.UserConfig().OS.ShellFunctionsFile).Run()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue