File tree Expand file tree Collapse file tree 1 file changed +11
-45
lines changed Expand file tree Collapse file tree 1 file changed +11
-45
lines changed Original file line number Diff line number Diff line change 1
1
2
2
# browser
3
- import "github.com/pkg/browser"
4
3
5
- Package browser provides helpers to open files , readers, and urls in a browser window .
4
+ Helpers to open URLs , readers, or files in the system default web browser .
6
5
7
- The choice of which browser is started is entirely client dependant.
6
+ This fork adds:
8
7
8
+ - [ safety] ( https://github.com/cli/safeexec#readme ) when running inside of an untrusted directory on Windows;
9
+ - WSL compatibility;
10
+ - ` ErrNotFound ` error wrapping on BSD;
11
+ - Go 1.13 support.
9
12
13
+ ## Usage
10
14
11
-
12
-
13
- ## Variables
14
15
``` go
15
- var Stderr io.Writer = os.Stderr
16
- ```
17
- Stderr is the io.Writer to which executed commands write standard error.
16
+ import " github.com/cli/browser"
18
17
19
- ``` go
20
- var Stdout io.Writer = os.Stdout
18
+ err = browser.OpenURL (url)
19
+ err = browser.OpenFile (path)
20
+ err = browser.OpenReader (reader)
21
21
```
22
- Stdout is the io.Writer to which executed commands write standard output.
23
-
24
-
25
- ## func OpenFile
26
- ``` go
27
- func OpenFile (path string ) error
28
- ```
29
- OpenFile opens new browser window for the file path.
30
-
31
-
32
- ## func OpenReader
33
- ``` go
34
- func OpenReader(r io.Reader) error
35
- ```
36
- OpenReader consumes the contents of r and presents the
37
- results in a new browser window.
38
-
39
-
40
- ## func OpenURL
41
- ``` go
42
- func OpenURL(url string) error
43
- ```
44
- OpenURL opens a new browser window pointing to url.
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
- - - -
55
- Generated by [godoc2md](http:// godoc.org/github.com/davecheney/godoc2md)
You can’t perform that action at this time.
0 commit comments