func openWithOpenOffice(url string) { getMSApplication(url) err2 := open.RunWith(url, "soffice.exe") if err2 != nil { log.Fatal(err2) } }
func viewHandler(w http.ResponseWriter, r *http.Request, title string) { p, err := loadPage(title) if err != nil { http.NotFound(w, r) return } c := make(chan bool) go func() { id := r.FormValue("id") cmd := "gotty --once -w -p 9999 docker exec -ti " + id + " bash" out, err := ssh.Run(cmd) if err != nil { panic("Can't run remote command: " + err.Error() + out) } c <- true }() time.Sleep(2 * time.Second) open.RunWith("http://"+host+":9999", "firefox") // wait for the blocking function to finish if it hasn't already <-c renderTemplate(w, "view", p) }
func openWithMac() { log.Print("This is Mac OS") err2 := open.RunWith("https://intranoo.silverpeas.com/silverpeas/repository/jackrabbit/webdav/attachments/kmelia1456/b97aeafc-0448-4d32-9f9f-8e1810a406f0/fr/Soutenance.odp", "libreoffice") if err2 != nil { log.Fatal(err2) } }
func main() { customURL := os.Args[1] customURL2 := strings.Replace(customURL, "spwebdav://", "http://", 1) webDavURL := strings.Replace(customURL2, "spwebdavs://", "https://", 1) err2 := open.RunWith(webDavURL, "soffice") if err2 != nil { log.Fatal(err2) } }
func openSnippetWithEditor(s *Snippet) { if len(conf.Editor) > 0 { err := open.RunWith(s.Path, conf.Editor) if err != nil { log.Fatalf("can't open %s with %s. please check your settings.", s.Path, conf.Editor) } } else { err := open.Run(s.Path) if err != nil { log.Fatalf("can't open %s. please check your settings.", s.Path) } } }
func openWithMSOffice(url string) { err2 := open.RunWith(url, getMSApplication(url)) if err2 != nil { log.Fatal(err2) } }