|
@@ -1,30 +1,16 @@
|
|
package main
|
|
package main
|
|
|
|
|
|
import (
|
|
import (
|
|
- "fmt"
|
|
|
|
"os/exec"
|
|
"os/exec"
|
|
)
|
|
)
|
|
|
|
|
|
// exec command
|
|
// exec command
|
|
func doCommand(cmd string) {
|
|
func doCommand(cmd string) {
|
|
- fmt.Println(cmd)
|
|
|
|
- cmdRes := exec.Command("libreoffice", "--headless", "--convert-to html", "*.doc", "--outdir", "output")
|
|
|
|
- stdout, err := cmdRes.Output()
|
|
|
|
- if err != nil {
|
|
|
|
- fmt.Println(err.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- fmt.Print(string(stdout))
|
|
|
|
- cmdRes2 := exec.Command("libreoffice", "--headless", "--convert-to html", "*.docx", "--outdir", "output")
|
|
|
|
- stdout2, err2 := cmdRes2.Output()
|
|
|
|
- if err2 != nil {
|
|
|
|
- fmt.Println(err2.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- fmt.Print("finish.... result is:")
|
|
|
|
- fmt.Print(string(stdout2))
|
|
|
|
|
|
+ _ = exec.Command("sh", "-c", cmd).Run()
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
func main() {
|
|
func main() {
|
|
- doCommand("go get -u github.com/golang/protobuf/protoc-gen-go")
|
|
|
|
|
|
+ doCommand("libreoffice --headless --convert-to html *.doc --outdir output")
|
|
|
|
+ doCommand("libreoffice --headless --convert-to html *.docx --outdir output")
|
|
}
|
|
}
|