mirror of
				https://github.com/go-task/task.git
				synced 2025-10-30 23:58:01 +02:00 
			
		
		
		
	refactor: embed the default Taskfile instead of defining it in code (#2112)
This commit is contained in:
		
							
								
								
									
										18
									
								
								init.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								init.go
									
									
									
									
									
								
							| @@ -1,28 +1,18 @@ | ||||
| package task | ||||
|  | ||||
| import ( | ||||
| 	_ "embed" | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/errors" | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| ) | ||||
|  | ||||
| const DefaultTaskfile = `# https://taskfile.dev | ||||
|  | ||||
| version: '3' | ||||
|  | ||||
| vars: | ||||
|   GREETING: Hello, World! | ||||
|  | ||||
| tasks: | ||||
|   default: | ||||
|     cmds: | ||||
|       - echo "{{.GREETING}}" | ||||
|     silent: true | ||||
| ` | ||||
|  | ||||
| const defaultTaskFilename = "Taskfile.yml" | ||||
|  | ||||
| //go:embed taskfile/templates/default.yml | ||||
| var DefaultTaskfile string | ||||
|  | ||||
| // InitTaskfile creates a new Taskfile at path. | ||||
| // | ||||
| // path can be either a file path or a directory path. | ||||
|   | ||||
							
								
								
									
										12
									
								
								taskfile/templates/default.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								taskfile/templates/default.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| # https://taskfile.dev | ||||
|  | ||||
| version: '3' | ||||
|  | ||||
| vars: | ||||
|   GREETING: Hello, World! | ||||
|  | ||||
| tasks: | ||||
|   default: | ||||
|     cmds: | ||||
|       - echo "{{.GREETING}}" | ||||
|     silent: true | ||||
		Reference in New Issue
	
	Block a user