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.

Github星跟踪图

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.

主要指标

概览
名称与所有者skratchdot/open-golang
主编程语言Go
编程语言Makefile (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2013-06-09 12:12:43
推送于2023-06-22 19:57:04
最后一次提交2020-01-16 00:55:34
发布数0
用户参与
星数798
关注者数17
派生数64
提交数28
已启用问题?
问题数22
打开的问题数14
拉请求数10
打开的拉请求数3
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?