convert.go 411 B

12345678910111213141516171819202122
  1. package main
  2. import (
  3. "fmt"
  4. "os/exec"
  5. )
  6. // exec command
  7. func doCommand(cmd string) {
  8. fmt.Println(cmd)
  9. cmdRes := exec.Command("libreoffice", "--headless", "--convert-to html", "*.doc", "--outdir", "output")
  10. stdout, err := cmdRes.Output()
  11. if err != nil {
  12. fmt.Println(err.Error())
  13. return
  14. }
  15. fmt.Print(string(stdout))
  16. }
  17. func main() {
  18. doCommand("go get -u github.com/golang/protobuf/protoc-gen-go")
  19. }