browser

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 5 Imported by: 0

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