Open a file, directory, or URI using the OS's default application for that object type. Optionally, you can specify an application to use.
Go to file
skratchdot eef8423979
Merge pull request #24 from brianredbeard/license-rename
Rename LICENSE-MIT to LICENSE
2020-01-16 00:55:34 -05:00
open causing goplay installation failed. 2019-04-01 22:31:27 +08:00
readme-template fixing typo in readme 2013-06-10 12:57:46 -04:00
vendor initial commit 2013-06-09 08:04:09 -04:00
.gitignore initial commit 2013-06-09 08:04:09 -04:00
LICENSE Rename LICENSE-MIT to LICENSE 2019-08-18 15:04:49 -07:00
Makefile initial commit 2013-06-09 08:04:09 -04:00
README.md fixing typo in readme 2013-06-10 12:57:46 -04:00

README.md

open

Description

Open a file, directory, or URI using the OS's default application for
that object type. Optionally, you can specify an application to use.

This is a proxy for the following commands:

        OSX: "open"
    Windows: "start"
Linux/Other: "xdg-open"

This is a golang port of the node.js module:
https://github.com/pwnall/node-open

Documentation

http://godoc.org/github.com/skratchdot/open-golang/open

Import

import "github.com/skratchdot/open-golang/open"

Usage

open google.com in the user's default browser (method 1):

open.Run("https://google.com/")

open google.com in the user's default browser (method 2):

open.Start("https://google.com")

you can listen for errors

err := open.Run("https://google.com/")

you can specify the program to use

open.RunWith("https://google.com/", "firefox")	

Functions

func Run(input string) error

Open a file, directory, or URI using the OS's default application for
that object type. Wait for the open command to complete.

func RunWith(input string, appName string) error

Open a file, directory, or URI using the specified application. Wait for
the open command to complete.

func Start(input string) error

Open a file, directory, or URI using the OS's default application for
that object type. Don't wait for the open command to complete.

func StartWith(input string, appName string) error

Open a file, directory, or URI using the specified application. Don't
wait for the open command to complete.

License

Copyright (c) 2013 skratchdot
Licensed under the MIT license.