mirror of
https://github.com/go-task/task.git
synced 2025-06-23 00:38:19 +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
|
package task
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/go-task/task/v3/errors"
|
"github.com/go-task/task/v3/errors"
|
||||||
"github.com/go-task/task/v3/internal/filepathext"
|
"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"
|
const defaultTaskFilename = "Taskfile.yml"
|
||||||
|
|
||||||
|
//go:embed taskfile/templates/default.yml
|
||||||
|
var DefaultTaskfile string
|
||||||
|
|
||||||
// InitTaskfile creates a new Taskfile at path.
|
// InitTaskfile creates a new Taskfile at path.
|
||||||
//
|
//
|
||||||
// path can be either a file path or a directory 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