You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
432 B
Go
26 lines
432 B
Go
package tsgen
|
|
|
|
import (
|
|
_ "embed"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
|
)
|
|
|
|
//go:embed request.ts
|
|
var requestTemplate string
|
|
|
|
func genRequest(dir string) error {
|
|
abs, err := filepath.Abs(dir)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
filename := filepath.Join(abs, "gocliRequest.ts")
|
|
if pathx.FileExists(filename) {
|
|
return nil
|
|
}
|
|
return os.WriteFile(filename, []byte(requestTemplate), 0644)
|
|
}
|