Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skratchdot/open-golang
Open a file, directory, or URI using the OS's default application for that object type. Optionally, you can specify an application to use.
https://github.com/skratchdot/open-golang
Last synced: 2 days ago
JSON representation
Open a file, directory, or URI using the OS's default application for that object type. Optionally, you can specify an application to use.
- Host: GitHub
- URL: https://github.com/skratchdot/open-golang
- Owner: skratchdot
- License: mit
- Created: 2013-06-09T12:12:43.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-06-22T19:57:04.000Z (over 1 year ago)
- Last Synced: 2024-12-05T00:06:11.470Z (9 days ago)
- Language: Go
- Size: 18.6 KB
- Stars: 789
- Watchers: 18
- Forks: 64
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](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 useopen.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.