package libreoffice

import "os/exec"

func Convert(from, toExt string, options ...string) error {
	libreoffice_args := []string{"--headless", "--convert-to", toExt}
	libreoffice_args = append(libreoffice_args, options...)
	libreoffice_args = append(libreoffice_args, from)

	err := exec.Command("libreoffice", libreoffice_args...).Run()
	// if string(out) != "" {
	// 	return fmt.Errorf("libreoffice: %s", string(out))
	// }
	if err != nil {
		return err
	}
	return nil
}
