mirror of
https://github.com/go-task/task.git
synced 2025-04-18 12:04:04 +03:00
refactor: embed the default Taskfile instead of defining it in code (#2112)
This commit is contained in:
parent
076aff1f8e
commit
d1360ee72a
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
|
Loading…
x
Reference in New Issue
Block a user