diff options
author | Mark Kopenga <mkopenga@gmail.com> | 2018-10-23 13:52:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 13:52:50 +0200 |
commit | 1fedda6a752133cb74ddd75c7c8a839835369f92 (patch) | |
tree | 0681e80d64dd2764595b445b8f22ac0bbf7e5bed /pkg/commands/os.go | |
parent | ac03665df34e8be89672fb98e202b182d745fdaf (diff) | |
parent | 3b6b68a2a1541fe26b39cba676b039f72142a28b (diff) |
Merge branch 'master' into https-ask-for-username-password
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 7bd714157..97db35ee5 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -12,9 +12,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/utils" "github.com/kr/pty" - "github.com/mgutz/str" - "github.com/sirupsen/logrus" gitconfig "github.com/tcnksm/go-gitconfig" ) @@ -26,6 +24,7 @@ type Platform struct { shellArg string escapedQuote string openCommand string + openLinkCommand string fallbackEscapedQuote string } @@ -199,6 +198,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) { |