browser

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package browser opens a URL in the user's browser.

Hand-rolled rather than taken from a library, for two reasons: the popular one leaks the launcher's stderr into the terminal, which lands in the middle of a login prompt, and detecting a headless machine matters more here than the launch itself. Roughly thirty lines is a fair trade.

The policy decisions — is a browser plausible, which command opens a URL — are pure functions of an OS name and an environment lookup. Reading the real process environment happens only in the two exported wrappers, so the policy can be asserted on any machine instead of only on the one running the test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available reports whether opening a browser is plausible on this machine.

A false answer is not fatal: ccdad prints the URL and waits for a pasted code either way. It only decides whether to attempt the launch and how to word the prompt.

func Open

func Open(url string) error

Open launches url. Failure is not fatal to a login — the caller has already printed the URL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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