alfred

package
v0.0.0-...-06445dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTasks

func AddTasks(contents []byte, context *Context, tasks map[string]Task) map[string]Task

AddTasks to the current task list

func CLI

func CLI(args []string) (string, []string)

CLI will take in os.args and return the task and argument

func Log

func Log(filename string, context *Context)

Log will set an external logger

func MagicTaskURL

func MagicTaskURL(task string) string

MagicTaskURL will parse "magic" tasks, as denoted by "__"

func NewTask

func NewTask(task string, context *Context, loadedTasks map[string]Task)

NewTask will execute a task

func TaskParser

func TaskParser(task, defaultTask string) (string, string)

TaskParser returns a url and a task(default if necessary) (location, task)

Types

type Component

type Component struct {
	Name string
	F    func(task Task, context *Context, tasks map[string]Task)
}

Component contains a name and function

type Context

type Context struct {
	TaskName    string
	Stdin       string
	Started     time.Time
	Log         map[string]*os.File
	Args        []string
	AllArgs     string
	Register    map[string]string
	Ok          bool
	Skip        string
	Text        TextConfig
	Silent      bool
	Status      string
	Component   string
	Vars        map[string]string
	Lock        *sync.Mutex
	Out         io.Writer
	Debug       bool
	FileName    string
	Interactive bool
	// contains filtered or unexported fields
}

Context contains the state of a task

func InitialContext

func InitialContext(args []string) *Context

InitialContext will return an empty context

func (*Context) GetVar

func (c *Context) GetVar(key, defaults string) string

GetVar will return a value with a given key, else returns default

func (*Context) SetVar

func (c *Context) SetVar(key, value string)

SetVar will the vars map with a given value

type HTTPTask

type HTTPTask struct {
	// contains filtered or unexported fields
}

HTTPTask contains all of our task information

type Task

type Task struct {
	Aliases  string
	Summary  string
	Usage    string
	Args     []string
	Setup    string
	Defaults []string
	Dir      string
	For      struct {
		Tasks     string
		MultiTask string
		Args      string
	}
	SlackSlashCommands struct {
		// contains filtered or unexported fields
	} `yaml:"slack.slash.commands"`
	HTTPTasks struct {
		Port     string
		Password string
	} `yaml:"http.tasks"`
	Config      string
	Log         string
	Every       string
	Command     string
	Retry       int
	Register    map[string]string
	Env         map[string]string
	Commands    string
	Serve       string
	Script      string
	Stdin       string
	Prompt      map[string]string
	Tasks       string
	MultiTask   string
	Ok          string
	Fail        string
	Wait        string
	Watch       string
	Private     bool
	ExitCode    int `yaml:"exit"`
	Skip        bool
	Interactive bool
	Plugin      map[string]string
	Check       string
	Include     string
}

Task holds all of our task components

func FetchTask

func FetchTask(task string, context *Context, tasks map[string]Task) (string, Task, map[string]Task)

FetchTask will fetch the tasks

func (*Task) Exit

func (t *Task) Exit(context *Context, tasks map[string]Task)

Exit determins whether a task should exit or not

func (*Task) IsPrivate

func (t *Task) IsPrivate() bool

IsPrivate determines if a task is private

func (*Task) ParseTaskGroup

func (t *Task) ParseTaskGroup(group string) []TaskGroup

ParseTaskGroup takes in a string, and parses it into a TaskGroup

type TaskGroup

type TaskGroup struct {
	Name string
	Args []string
}

TaskGroup contains a task name and it's arguments

type TextConfig

type TextConfig struct {
	DisableFormatting bool
	Success           string
	SuccessIcon       string
	Failure           string
	FailureIcon       string
	Task              string
	Warning           string
	Args              string
	Command           string
	Reset             string

	// color codes
	Grey   string
	Orange string
	Green  string
}

TextConfig contains configuration needed to display text

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL