Skip to content

Commit d1360ee

Browse files
authored
refactor: embed the default Taskfile instead of defining it in code (#2112)
1 parent 076aff1 commit d1360ee

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

init.go

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
package task
22

33
import (
4+
_ "embed"
45
"os"
56

67
"github.com/go-task/task/v3/errors"
78
"github.com/go-task/task/v3/internal/filepathext"
89
)
910

10-
const DefaultTaskfile = `# https://taskfile.dev
11-
12-
version: '3'
13-
14-
vars:
15-
GREETING: Hello, World!
16-
17-
tasks:
18-
default:
19-
cmds:
20-
- echo "{{.GREETING}}"
21-
silent: true
22-
`
23-
2411
const defaultTaskFilename = "Taskfile.yml"
2512

13+
//go:embed taskfile/templates/default.yml
14+
var DefaultTaskfile string
15+
2616
// InitTaskfile creates a new Taskfile at path.
2717
//
2818
// path can be either a file path or a directory path.

taskfile/templates/default.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://taskfile.dev
2+
3+
version: '3'
4+
5+
vars:
6+
GREETING: Hello, World!
7+
8+
tasks:
9+
default:
10+
cmds:
11+
- echo "{{.GREETING}}"
12+
silent: true

0 commit comments

Comments
 (0)