error output pattern added to init cmd

This commit is contained in:
alessio 2017-06-16 11:48:25 +02:00
parent e2c06878f5
commit f2f11c7e47
4 changed files with 20 additions and 8 deletions

View File

@ -869,6 +869,24 @@ func main() {
return nil
},
},
{
Before: func(d interact.Context) error {
d.SetDef("", style.Green.Regular("(none)"))
return nil
},
Quest: interact.Quest{
Options: style.Yellow.Regular("[string]"),
Msg: "Set an error output pattern",
},
Action: func(d interact.Context) interface{} {
val, err := d.Ans().String()
if err != nil {
return d.Err()
}
r.Blueprint.Projects[len(r.Blueprint.Projects)-1].ErrorOutputPattern = val
return nil
},
},
},
Action: func(d interact.Context) interface{} {
if val, err := d.Ans().Bool(); err != nil {

View File

@ -91,7 +91,6 @@ func (h *Blueprint) Add(p *cli.Context) error {
Scripts: []Command{},
},
Streams: Streams{
CliOut: true,
FileOut: false,
FileLog: false,
FileErr: false,
@ -170,7 +169,6 @@ func (h *Blueprint) List() error {
}
}
fmt.Println(name, style.Yellow.Regular("Streams"), ":")
fmt.Println(name, "\t", style.Yellow.Regular("Cli Out"), ":", style.Magenta.Regular(val.Streams.CliOut))
fmt.Println(name, "\t", style.Yellow.Regular("File Out"), ":", style.Magenta.Regular(val.Streams.FileOut))
fmt.Println(name, "\t", style.Yellow.Regular("File Log"), ":", style.Magenta.Regular(val.Streams.FileLog))
fmt.Println(name, "\t", style.Yellow.Regular("File Err"), ":", style.Magenta.Regular(val.Streams.FileErr))

View File

@ -39,9 +39,9 @@ type Project struct {
Cmds Cmds `yaml:"commands" json:"commands"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Watcher Watcher `yaml:"watcher" json:"watcher"`
Streams Streams `yaml:"streams" json:"streams"`
Streams Streams `yaml:"streams,omitempty" json:"streams,omitempty"`
Buffer Buffer `yaml:"-" json:"buffer"`
ErrorOutputPattern string `yaml:"errorOutputPattern" json:"errorOutputPattern"`
ErrorOutputPattern string `yaml:"errorOutputPattern,omitempty" json:"errorOutputPattern,omitempty"`
parent *Blueprint
path string
tools tools
@ -92,7 +92,6 @@ type Command struct {
// Streams is a collection of names and values for the logs functionality
type Streams struct {
CliOut bool `yaml:"cli_out" json:"cli_out"`
FileOut bool `yaml:"file_out" json:"file_out"`
FileLog bool `yaml:"file_log" json:"file_log"`
FileErr bool `yaml:"file_err" json:"file_err"`

View File

@ -384,9 +384,6 @@ func (p *Project) print(t string, o BufferOut, msg string, stream string) {
p.Fatal(err, "")
}
}
if msg != "" && p.Streams.CliOut {
log.Print(msg)
}
case "log":
p.Buffer.StdLog = append(p.Buffer.StdLog, o)
if p.Streams.FileLog {