Go library for Alfred 3 workflows
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_examples Remove .autoenv files from repo Dec 23, 2018
fuzzy Increase test coverage Dec 7, 2018
update Add coverage to Codacy from Travis Dec 7, 2018
util Increase test coverage Dec 7, 2018
.gitignore Different way to integrate Travis Jun 30, 2018
.gitlab-ci.yml Retry GitLab CI Dec 8, 2018
.travis.yml CI doesn't fail if coveralls/codacy is down Dec 8, 2018
Gopkg.lock Use dep Jun 30, 2018
Gopkg.toml Use dep Jun 30, 2018
Icon-256.png Project gotta have an icon Sep 15, 2017
Icon-512.png Project gotta have an icon Sep 15, 2017
Icon.png Project gotta have an icon Sep 15, 2017
Icon.sketch Add "match" field to Item and use it for fuzzy sorting Sep 15, 2017
LICENCE Change package name to aw Oct 31, 2016
README.md Bump version numbers in source Dec 8, 2018
TODO Update TODO Mar 9, 2018
alfred.go
alfred_test.go Smaller copyright/licence notice Dec 7, 2018
background.go Smaller copyright/licence notice Dec 7, 2018
background_test.go Smaller copyright/licence notice Dec 7, 2018
bench.py Add AppleScript benchmarking script Jun 30, 2018
cache.go Remove .autoenv files from repo Dec 23, 2018
cache_examples_test.go Smaller copyright/licence notice Dec 7, 2018
cache_test.go Smaller copyright/licence notice Dec 7, 2018
config.go Smaller copyright/licence notice Dec 7, 2018
config_bind.go Smaller copyright/licence notice Dec 7, 2018
config_bind_test.go Smaller copyright/licence notice Dec 7, 2018
config_test.go Smaller copyright/licence notice Dec 7, 2018
doc.go Use proper struct name in comment Dec 23, 2018
env.go Smaller copyright/licence notice Dec 7, 2018
env.sh Bump version numbers in source Dec 8, 2018
feedback.go Smaller copyright/licence notice Dec 7, 2018
feedback_test.go Smaller copyright/licence notice Dec 7, 2018
icons.go Smaller copyright/licence notice Dec 7, 2018
icons_test.go Smaller copyright/licence notice Dec 7, 2018
magic.go Increase test coverage Dec 7, 2018
magic_test.go Smaller copyright/licence notice Dec 7, 2018
modd.conf Improve examples Jun 30, 2018
run-tests.sh Bump version numbers in source Dec 8, 2018
testutils_test.go Bump version numbers in source Dec 8, 2018
workflow.go Bump version numbers in source Dec 8, 2018
workflow_feedback.go Smaller copyright/licence notice Dec 7, 2018
workflow_options.go Smaller copyright/licence notice Dec 7, 2018
workflow_paths.go Smaller copyright/licence notice Dec 7, 2018
workflow_test.go Bump version numbers in source Dec 8, 2018
workflow_update.go Smaller copyright/licence notice Dec 7, 2018

README.md

AwGo Logo

AwGo — A Go library for Alfred workflows

Build Status Go Report Card Codacy Badge Coverage Status GoDoc

Full-featured library to build lightning-fast workflows in a jiffy.

Features

Installation & usage

Install AwGo with:

go get -u github.com/deanishe/awgo

Typically, you'd call your program's main entry point via Workflow.Run(). This way, the library will rescue any panic, log the stack trace and show an error message to the user in Alfred.

program.go:

package main

// Package is called aw
import "github.com/deanishe/awgo"

// Workflow is the main API
var wf *aw.Workflow

func init() {
    // Create a new Workflow using default settings.
    // Critical settings are provided by Alfred via environment variables,
    // so this *will* die in flames if not run in an Alfred-like environment.
    wf = aw.New()
}

// Your workflow starts here
func run() {
    // Add a "Script Filter" result
    wf.NewItem("First result!")
    // Send results to Alfred
    wf.SendFeedback()
}

func main() {
    // Wrap your entry point with Run() to catch and log panics and
    // show an error in Alfred instead of silently dying
    wf.Run(run)
}

In the Script Filter's Script box (Language = /bin/bash with input as argv):

./program "$1"

Documentation

Read the docs on GoDoc.

Check out the example workflows (docs), which show how to use AwGo. Use one as a template to get your own workflow up and running quickly.

Requirements

The library (and therefore the unit tests) rely on being run in a minimally Alfred-like environment, as they pull configuration options from the environment variables set by Alfred.

This means that if you want to run AwGo-based code outside Alfred, e.g. in your shell, you must set at least the following environment variables to meaningful values, or the library will panic:

  • alfred_workflow_bundleid
  • alfred_workflow_cache
  • alfred_workflow_data

And if you're using the update API, also:

  • alfred_workflow_version

Development

To create a sufficiently Alfred-like environment, you can source the env.sh script in the project root or run unit tests via the run-tests.sh script (which also sets up an appropriate environment before calling go test).

Licensing & thanks

This library is released under the MIT licence.

The icon is based on the Go Gopher by Renee French.