fes

Free Easy Site
Log | Files | Refs | README | LICENSE

doc.go (389B)


      1 package doc
      2 
      3 import (
      4 	"fes/modules/config"
      5 	"fmt"
      6 	"os"
      7 	"path/filepath"
      8 
      9 	"github.com/pkg/browser"
     10 )
     11 
     12 /* open documentation in browser */
     13 func Open() error {
     14 	fmt.Println("Opening documentation in browser")
     15 
     16 	tmpFile := filepath.Join(os.TempDir(), "doc.html")
     17 
     18 	if err := os.WriteFile(tmpFile, []byte(config.Doc), 0644); err != nil {
     19 		return err
     20 	}
     21 
     22 	return browser.OpenFile(tmpFile)
     23 }