This commit is contained in:
2025-12-07 10:15:32 -05:00
parent b89dc65e1f
commit 4ff689e299
31 changed files with 13 additions and 40 deletions

View File

@@ -9,6 +9,7 @@ import (
"strings"
)
/* try to get git user, if not system user */
func getName() string {
out, err := exec.Command("git", "config", "user.name").Output()
if err == nil {
@@ -21,43 +22,10 @@ func getName() string {
if err == nil && u.Username != "" {
return u.Username
}
return ""
return "unknown"
}
// func Project(dir string) error {
// if err := os.MkdirAll(filepath.Join(dir, "www"), 0755); err != nil {
// return err
// }
// indexLua := filepath.Join(dir, "www", "index.lua")
// if _, err := os.Stat(indexLua); os.IsNotExist(err) {
// content := fmt.Sprintf(`local fes = require("fes")
// local site = fes.fes()
//
// site.title = "%s"
//
// site:h1("Hello, World!")
//
// return site
// `, dir)
// if err := os.WriteFile(indexLua, []byte(content), 0644); err != nil {
// return err
// }
// }
// indexFes := filepath.Join(dir, "Fes.toml")
// if _, err := os.Stat(indexFes); os.IsNotExist(err) {
// content := fmt.Sprintf(`[app]
//
// name = "%s"
// version = "0.0.1"
// authors = ["%s"]`, dir, getName())
// if err := os.WriteFile(indexFes, []byte(content), 0644); err != nil {
// return err
// }
// }
// fmt.Println("Created new project at", dir)
// return nil
// }
/* helper function for writing files */
func write(path string, format string, args ...interface{}) error {
dir := filepath.Dir(path)
if err := os.MkdirAll(dir, 0755); err != nil {
@@ -72,6 +40,7 @@ func write(path string, format string, args ...interface{}) error {
return err
}
/* creates a hello world project */
func Project(dir string) error {
if err := os.Mkdir(dir, 0755); err != nil {
return err