1
0
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:
Sascha Andres
2017-03-07 09:45:14 +01:00
parent f686c7598f
commit 6636cd38c0
3 changed files with 65 additions and 19 deletions

17
task.go
View File

@@ -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
}