open.go

 1/*
 2
 3	Open a file, directory, or URI using the OS's default
 4	application for that object type.  Optionally, you can
 5	specify an application to use.
 6
 7	This is a proxy for the following commands:
 8
 9	         OSX: "open"
10	     Windows: "start"
11	 Linux/Other: "xdg-open"
12
13	This is a golang port of the node.js module: https://github.com/pwnall/node-open
14
15*/
16package open
17
18/*
19	Open a file, directory, or URI using the OS's default
20	application for that object type. Wait for the open
21	command to complete.
22*/
23func Run(input string) error {
24	return open(input).Run()
25}
26
27/*
28	Open a file, directory, or URI using the OS's default
29	application for that object type. Don't wait for the
30	open command to complete.
31*/
32func Start(input string) error {
33	return open(input).Start()
34}
35
36/*
37	Open a file, directory, or URI using the specified application.
38	Wait for the open command to complete.
39*/
40func RunWith(input string, appName string) error {
41	return openWith(input, appName).Run()
42}
43
44/*
45	Open a file, directory, or URI using the specified application.
46	Don't wait for the open command to complete.
47*/
48func StartWith(input string, appName string) error {
49	return openWith(input, appName).Start()
50}