Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 1.09 KB

README.md

File metadata and controls

80 lines (57 loc) · 1.09 KB

marionette

A tiny package for manipulating the default browser cross platform.

Practical Example

package main

import (
    "fmt"
    "github.com/LQR471814/marionette"
)

func main() {
    browser, err := marionette.DefaultBrowser()
    if err != nil {
        panic(err)
    }

    switch browser {
    case marionette.CHROME, marionette.EDGE:
        marionette.OpenBrowser(`--app=https://google.com`, `--guest`)
    default:
        fmt.Println("The default browser configured on this computer isn't supported!")
    }
}

Constants

const (
	UNDEFINED BrowserType = iota
	CHROME
	EDGE
	FIREFOX
)

Functions

func DefaultBrowser

func DefaultBrowser() (BrowserType, error)

func GetBrowserPath

func GetBrowserPath() (string, error)

func OpenBrowser

func OpenBrowser(args ...string) error

Types

type BrowserType

type BrowserType int

type UnknownBrowserType

type UnknownBrowserType struct{}

func (*UnknownBrowserType) Error() string

func (*UnknownBrowserType) Error() string