feat: path auto resolution

This commit is contained in:
2025-03-08 20:54:22 +07:00
parent 5d3584f6bf
commit 7b606129b8
2 changed files with 14 additions and 24 deletions

View File

@@ -1,16 +1,16 @@
package generation
import (
"fmt"
"log"
"nto_cli/entities"
"nto_cli/utils"
"os"
"path/filepath"
"strings"
)
func Generate(structName string, fields []entities.Field) {
mkPath := fmt.Sprintf("%s/frontend/src/%s", utils.FindFrontendPath(), strings.ToLower(structName))
mkPath := filepath.Join(utils.FindFrontendPath(), strings.ToLower(structName))
if err := os.Mkdir(mkPath, 0755); err != nil {
log.Fatalf("Failed to mkdir for model: %s", err)
}