github.com/opentofu/opentofu@v1.7.1/internal/command/webbrowser/webbrowser.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  // Launcher is an object that knows how to open a given URL in a new tab in
     9  // some suitable browser on the current system.
    10  //
    11  // Launching of browsers is a very target-platform-sensitive activity, so
    12  // this interface serves as an abstraction over many possible implementations
    13  // which can be selected based on what is appropriate for a specific situation.
    14  type Launcher interface {
    15  	// OpenURL opens the given URL in a web browser.
    16  	//
    17  	// Depending on the circumstances and on the target platform, this may or
    18  	// may not cause the browser to take input focus. Because of this
    19  	// uncertainty, any caller of this method must be sure to include some
    20  	// language in its UI output to let the user know that a browser tab has
    21  	// opened somewhere, so that they can go and find it if the focus didn't
    22  	// switch automatically.
    23  	OpenURL(url string) error
    24  }