Skip to content

A tiny package for manipulating the default browser cross platform.

Notifications You must be signed in to change notification settings

LQR471814/marionette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A tiny package for manipulating the default browser cross platform.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages