github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/command/webbrowser/native.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package webbrowser
     5  
     6  import (
     7  	"github.com/pkg/browser"
     8  )
     9  
    10  // NewNativeLauncher creates and returns a Launcher that will attempt to interact
    11  // with the browser-launching mechanisms of the operating system where the
    12  // program is currently running.
    13  func NewNativeLauncher() Launcher {
    14  	return nativeLauncher{}
    15  }
    16  
    17  type nativeLauncher struct{}
    18  
    19  func (l nativeLauncher) OpenURL(url string) error {
    20  	return browser.OpenURL(url)
    21  }