mirror of
https://github.com/go-task/task.git
synced 2025-11-25 22:32:55 +02:00
Implemented os specific task file support
This commit is contained in:
17
task.go
17
task.go
@@ -1,16 +1,12 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/spf13/pflag"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -168,16 +164,3 @@ func (t *Task) runCommand(i int) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func readTaskfile() (tasks map[string]*Task, err error) {
|
||||
if b, err := ioutil.ReadFile(TaskFilePath + ".yml"); err == nil {
|
||||
return tasks, yaml.Unmarshal(b, &tasks)
|
||||
}
|
||||
if b, err := ioutil.ReadFile(TaskFilePath + ".json"); err == nil {
|
||||
return tasks, json.Unmarshal(b, &tasks)
|
||||
}
|
||||
if b, err := ioutil.ReadFile(TaskFilePath + ".toml"); err == nil {
|
||||
return tasks, toml.Unmarshal(b, &tasks)
|
||||
}
|
||||
return nil, ErrNoTaskFile
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user