go-KodeStarter/cmdCreate/createDir.go

27 lines
578 B
Go
Raw Permalink Normal View History

2023-07-08 00:45:18 -04:00
package cmdCreate
import (
"fmt"
"kode-creator/structures"
"kode-creator/utils"
"log"
"os"
)
// The function creates a directory for a project and changes the current working directory to the
// newly created directory.
func CreateProjectStructure(project structures.Project) {
fmt.Println("==> Creating directory...")
// Create directory of the project
fmt.Println("==> Creating directory...")
utils.CreateDir(project.Name)
fmt.Println("==> Created directory")
// Change to project directory
err := os.Chdir(project.Name)
if err != nil {
log.Fatal(err)
}
}