open

package
v1.43.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package open provides utilities for opening URLs in a browser.

Index

Constants

This section is empty.

Variables

View Source
var StartCommand = func(cmd *exec.Cmd) error {
	return cmd.Start()
}

StartCommand starts an exec.Cmd. Overridden in tests to avoid launching a real browser.

Functions

func Browser

func Browser(url string) error

Browser takes a url and opens it using the default browser on the operating system

func CanOpenBrowser added in v1.5.7

func CanOpenBrowser() bool

CanOpenBrowser determines if no browser is set in linux

func OpenURL added in v1.43.3

func OpenURL(ctx context.Context, u *url.URL, allowedHosts map[string]bool) error

OpenURL opens the given URL in the user's default browser. allowedHosts restricts which hostnames may be opened; pass nil to allow any https URL. The URL must use the https scheme.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL