diff options
author | mjarkk <mkopenga@gmail.com> | 2018-10-27 14:37:31 +0200 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-10-27 14:37:31 +0200 |
commit | 959d6fa2cae500d86199be2d5f9da9b64c272bff (patch) | |
tree | 15209f0e24c09cefc169fc78c21a6f598763f132 /pkg/commands/os.go | |
parent | e47c597b3a2d1101984bd7f402a0ca761fbf7169 (diff) | |
parent | 1fedda6a752133cb74ddd75c7c8a839835369f92 (diff) |
Made it possible to build for windows again
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r-- | pkg/commands/os.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go index e99ffbbb7..0530962ed 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -9,9 +9,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/utils" - "github.com/mgutz/str" - "github.com/sirupsen/logrus" gitconfig "github.com/tcnksm/go-gitconfig" ) @@ -23,6 +21,7 @@ type Platform struct { shellArg string escapedQuote string openCommand string + openLinkCommand string fallbackEscapedQuote string } @@ -157,6 +156,18 @@ func (c *OSCommand) OpenFile(filename string) error { return err } +// OpenFile opens a file with the given +func (c *OSCommand) OpenLink(link string) error { + commandTemplate := c.Config.GetUserConfig().GetString("os.openLinkCommand") + templateValues := map[string]string{ + "link": c.Quote(link), + } + + command := utils.ResolvePlaceholderString(commandTemplate, templateValues) + err := c.RunCommand(command) + return err +} + // EditFile opens a file in a subprocess using whatever editor is available, // falling back to core.editor, VISUAL, EDITOR, then vi func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) { |