Browse Source

init generation files added

luis 6 years ago
parent
commit
21561fcd85
2 changed files with 18 additions and 8 deletions
  1. 10 8
      .boiler/config.yml
  2. 8 0
      .boiler/templates/gomain.go.boiler

+ 10 - 8
.boiler/config.yml

@@ -3,16 +3,18 @@ vars:
   - {name: binary, default: '{{.projName}}'}
   - {name: author}
   - {name: email}
-  - {name: maingo, default: '{{.binary}}/cmd/main.go', question: 'main go file'}
+  - {name: maingo, default: '{{.projName}}/cmd/{{.binary}}', question: 'Main Package'}
+files:
+  - {source: 'gomain.go.boiler', target: 'go/src/{{.projName}}/cmd/{{.binary}}/main.go'}
 generators:
  gofile:
     aliases: [.go]
-    description: Creates a go file based on template                   # Description for --help
+    description: 'Creates a go file based on template'                   # Description for --help
     files:                                                             # Files or folders to be processed, these files are relative to $PROJROOT/.boiler/template/...
-      - {source: gofile.go.boiler, target: "{{.curdir}}/{{.name}}"}    # Target is processed with template
+      - {source: 'gofile.go.boiler', target: '{{.curdir}}/{{.name}}'}    # Target is processed with template
     vars:                                                              # List of variables for unit creation
-      - name: package                                                  # Var name {{.package}}
-        default: "{{.projName}}"                                       # Default value 
-        flag: "package, p"                                             # command flags to set this var
-        question: package name of the new file                         # question to be shown on interactive input
-        description: Package to place on package thing                 # description of the var '--help'
+      - name: 'package'                                                  # Var name {{.package}}
+        default: '{{.projName}}'                                       # Default value 
+        flag: 'package, p'                                             # command flags to set this var
+        question: 'package name of the new file'                         # question to be shown on interactive input
+        description: 'Package to place on package thing'                 # description of the var '--help'

+ 8 - 0
.boiler/templates/gomain.go.boiler

@@ -0,0 +1,8 @@
+// {{.author}} {{.email}}
+package main
+
+import "fmt"
+
+func main() {
+	fmt.Println("Hello world")
+}