github.com/opentofu/opentofu@v1.7.1/internal/command/webbrowser/native.go (about)

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