github.com/kcmerrill/alfred@v0.0.0-20180727171036-06445dcb5e3d/pkg/alfred/summary.go (about)

     1  package alfred
     2  
     3  import (
     4  	"strings"
     5  	"time"
     6  )
     7  
     8  func summary(task Task, context *Context, tasks map[string]Task) {
     9  	if task.Summary != "" {
    10  		outOK("started ["+strings.Join(context.Args, ", ")+"]", task.Summary, context)
    11  	} else {
    12  		outOK("started ["+strings.Join(context.Args, ", ")+"]", "", context)
    13  	}
    14  }
    15  
    16  func result(task Task, context *Context, tasks map[string]Task) {
    17  	if context.Ok {
    18  		outOK("{{ .Text.SuccessIcon }} ok ["+strings.Join(context.Args, ", ")+"]", "elapsed time {{ .Text.Grey }}'{{ .Text.Success }}"+time.Since(context.Started).Round(time.Second).String()+"{{ .Text.Grey }}'", context)
    19  	} else {
    20  		outFail("{{ .Text.FailureIcon }} failed ["+strings.Join(context.Args, ", ")+"]", "elapsed time {{ .Text.Grey }}'{{ .Text.Success }}"+time.Since(context.Started).Round(time.Second).String()+"{{ .Text.Grey }}'", context)
    21  	}
    22  }