├── go.mod ├── README.md ├── .gitignore └── main.go /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gnomedevreact/mrn 2 | 3 | go 1.24.3 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mrn 2 | 3 | `mrn` is a lightweight and flexible CLI tool for Go developers that helps scaffold basic folder structures and boilerplate files for new feature modules. 4 | 5 | ## Features 6 | 7 | - 🛠 Auto-generates a new folder with: 8 | - `handlers.go` 9 | - `models.go` 10 | - `services.go` 11 | - 🔁 Simple and repeatable CLI usage 12 | - 🧼 Clean and idiomatic file templates 13 | - 🧱 Helps keep your project modular and consistent 14 | 15 | ## Installation 16 | 17 | ```bash 18 | go install github.com/gnomedevreact/mrn@latest 19 | ``` 20 | 21 | # Usage 22 | 23 | ```bash 24 | mrn 25 | ``` 26 | 27 | # Example 28 | ``` 29 | mrn users ./api 30 | ``` 31 | This will create: 32 | 33 | ``` 34 | ./api/users/ 35 | ├── handlers.go 36 | ├── models.go 37 | └── services.go 38 | ``` 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binary files 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | *.test 8 | *.out 9 | 10 | # Temporary files and directories 11 | *.log 12 | *.tmp 13 | *.temp 14 | *.cache 15 | 16 | # Go build artifacts 17 | bin/ 18 | obj/ 19 | vendor/ # If you use Go modules, vendor can be safely ignored 20 | 21 | # Editor and IDE files 22 | .vscode/ 23 | .idea/ 24 | *.iml 25 | 26 | # Go module and dependency files (lock files) 27 | go.sum 28 | Gopkg.lock 29 | 30 | # Go module cache 31 | /pkg/mod/ 32 | 33 | # System files 34 | .DS_Store 35 | Thumbs.db 36 | 37 | # Environment and config files (may contain secrets) 38 | .env 39 | .env.local 40 | .env.*.local 41 | *.pem 42 | 43 | # Profiling/debugging outputs 44 | *.prof 45 | 46 | # Docker override files (usually environment-specific) 47 | docker-compose.override.yml 48 | 49 | # macOS metadata 50 | .AppleDouble 51 | .LSOverride 52 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | ) 8 | 9 | func main() { 10 | if len(os.Args) < 3 { 11 | fmt.Println("Usage: generate ") 12 | return 13 | } 14 | 15 | module := os.Args[1] 16 | outputDir := os.Args[2] 17 | targetDir := filepath.Join(outputDir, module) 18 | 19 | err := os.MkdirAll(targetDir, os.ModePerm) 20 | if err != nil { 21 | fmt.Printf("Failed to create directory: %v\n", err) 22 | return 23 | } 24 | 25 | files := []string{"handlers.go", "models.go", "services.go"} 26 | for _, file := range files { 27 | path := filepath.Join(targetDir, file) 28 | content := fmt.Sprintf("package %s\n\n", module) 29 | err := os.WriteFile(path, []byte(content), 0644) 30 | if err != nil { 31 | fmt.Printf("Failed to create file %s: %v\n", file, err) 32 | return 33 | } 34 | } 35 | 36 | fmt.Printf("Module '%s' generated in %s\n", module, targetDir) 37 | } 38 | --------------------------------------------------------------------------------