first commit

This commit is contained in:
2024-07-23 10:23:43 +08:00
commit 7b4c2521a3
126 changed files with 15931 additions and 0 deletions

23
pkg/browser/browser.go Normal file
View File

@ -0,0 +1,23 @@
package browser
import (
"fmt"
"os/exec"
"runtime"
)
var commands = map[string]string{
"windows": "start",
"darwin": "open",
"linux": "xdg-open",
}
func Open(uri string) error {
run, ok := commands[runtime.GOOS]
if !ok {
return fmt.Errorf("don't know how to open things on %s platform", runtime.GOOS)
}
cmd := exec.Command(run, uri)
return cmd.Start()
}