openwith

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 6 Imported by: 1

README

Go Report Card Go Reference

Getting Started

Install Open With

go get -u github.com/barandemirbas/open-with

Add to your imports to start using Open With

import "github.com/barandemirbas/open-with"

Functions

Browser function opens a new browser tab for pointing url with default browser.

openwith.Browser("https://github.com/barandemirbas/open-with")
openwith.Browser("127.0.0.1", 8000) // http://127.0.0.1:8000
openwith.Browser("127.0.0.1/path", 8000) // http://127.0.0.1:8000/path 

Examples

Example with Browser function:

package main

import (
	"github.com/barandemirbas/open-with"
	"net/http"
)

type HttpHandler struct{}

func (h HttpHandler) ServeHTTP(res http.ResponseWriter, req *http.Request) {
	res.Write([]byte("Hello World!"))
}

func main() {
	openwith.Browser("127.0.0.1", 8000)
	http.ListenAndServe(":8000", HttpHandler{})
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Browser

func Browser(URL string, PORT ...int) (*exec.Cmd, error)

Browser function opens a new browser tab for pointing url with 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