Categorygithub.com/pascalw/go-alfred
modulepackage
0.0.0-20160913054623-16aeb807166c
Repository: https://github.com/pascalw/go-alfred.git
Documentation: pkg.go.dev

# README

go-alfred

Go-alfred is a utility library for quickly writing lightning fast Alfred 2 workflows using Golang.

Example usage

package main

import (
	"os"
	"github.com/pascalw/go-alfred"
	"net/http"
	"io/ioutil"
	"encoding/json"
)

func main() {
	queryTerms := os.Args[1:]

	// optimize query terms for fuzzy matching
	alfred.InitTerms(queryTerms)

	// create a new alfred workflow response
	response := alfred.NewResponse()
	repos := getRepos()

	for _, repo := range repos {
		// check if the repo name fuzzy matches the query terms
		if ! alfred.MatchesTerms(queryTerms, repo.Name) { continue }

		// it matched so add a new response item
		response.AddItem(&alfred.AlfredResponseItem{
			Valid: true,
			Uid: repo.URL,
			Title: repo.Name,
			Arg: repo.URL,
		})
	}

	// finally print the resulting Alfred Workflow XML
	response.Print()
}	

See Example/ for details.

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author