mirror of
https://github.com/go-task/task.git
synced 2025-06-23 00:38:19 +02:00
chore: changelog and minor adjustments for #2018
This commit is contained in:
7
init.go
7
init.go
@ -1,7 +1,6 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/go-task/task/v3/errors"
|
||||
@ -22,7 +21,7 @@ tasks:
|
||||
silent: true
|
||||
`
|
||||
|
||||
const DefaultTaskFilename = "Taskfile.yml"
|
||||
const defaultTaskFilename = "Taskfile.yml"
|
||||
|
||||
// InitTaskfile creates a new Taskfile at path.
|
||||
//
|
||||
@ -30,14 +29,14 @@ const DefaultTaskFilename = "Taskfile.yml"
|
||||
// If path is a directory, path/Taskfile.yml will be created.
|
||||
//
|
||||
// The final file path is always returned and may be different from the input path.
|
||||
func InitTaskfile(w io.Writer, path string) (string, error) {
|
||||
func InitTaskfile(path string) (string, error) {
|
||||
fi, err := os.Stat(path)
|
||||
if err == nil && !fi.IsDir() {
|
||||
return path, errors.TaskfileAlreadyExistsError{}
|
||||
}
|
||||
|
||||
if fi != nil && fi.IsDir() {
|
||||
path = filepathext.SmartJoin(path, DefaultTaskFilename)
|
||||
path = filepathext.SmartJoin(path, defaultTaskFilename)
|
||||
// path was a directory, so check if Taskfile.yml exists in it
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return path, errors.TaskfileAlreadyExistsError{}
|
||||
|
Reference in New Issue
Block a user