diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/open.go | 12 | ||||
-rw-r--r-- | lib/open_darwin.go | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/open.go b/lib/open.go new file mode 100644 index 00000000..ad6533e1 --- /dev/null +++ b/lib/open.go @@ -0,0 +1,12 @@ +// +build !darwin + +package lib + +import ( + "os/exec" +) + +func OpenFile(filename string) error { + cmd := exec.Command("xdg-open", filename) + return cmd.Run() +} diff --git a/lib/open_darwin.go b/lib/open_darwin.go new file mode 100644 index 00000000..0ffd9a16 --- /dev/null +++ b/lib/open_darwin.go @@ -0,0 +1,10 @@ +package lib + +import ( + "os/exec" +) + +func OpenFile(filename string) error { + cmd := exec.Command("open", filename) + return cmd.Run() +} |