browser

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: MIT Imports: 5 Imported by: 8

README

Browser

Go lib to open a link with the default web browser in the background. Works on Mac, Linux and Windows.

On Windows and Mac, the cmd and open utilities are installed by default, so there's no additional requirement necessary. For linux distributions, the xdg-utils package is required to open the browser window. xdg-utils is required for Linux Standards Base (LSB) conformance, so it should be available on most distributions of Linux.

This project is a copypasta of pkg/webbrowser from the workflow-cli project which we worked on at Deis. Chocolates and flowers should be sent to @Joshua-Anderson for all his hard work figuring out the right commands to invoke the default web browser from the terminal.

Usage

package main

import (
	"log"

	"github.com/bacongobbler/browser"
)

func main() {
	if err := browser.Open("https://example.com"); err != nil {
		log.Fatal(err)
	}
}
$ go get github.com/bacongobbler/browser
$ go run main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(u string) (err error)

Open opens a URL with the default browser.

Types

This section is empty.

Jump to

Keyboard shortcuts

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