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

     1  package alfred
     2  
     3  import (
     4  	"strings"
     5  )
     6  
     7  func commands(task Task, context *Context, tasks map[string]Task) {
     8  	if task.Commands == "" || !context.Ok {
     9  		return
    10  	}
    11  
    12  	cmds := strings.Split(task.Commands, "\n")
    13  	for _, cmd := range cmds {
    14  		// the task component
    15  		command(cmd, task, context, tasks)
    16  		if !context.Ok {
    17  			// command failed?
    18  			break
    19  		}
    20  	}
    21  }