Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Go library for Alfred 3 + 4 workflows

License

NotificationsYou must be signed in to change notification settings

deanishe/awgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AwGo Logo

AwGo — A Go library for Alfred workflows

Build StatusGo Report CardCoverage StatusGo Reference

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 viaWorkflow.Run().This way, the library will rescue any panic, log the stack trace and showan error message to the user in Alfred.

program.go:

package main// Package is called awimport"github.com/deanishe/awgo"// Workflow is the main APIvarwf*aw.Workflowfuncinit() {// 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 herefuncrun() {// Add a "Script Filter" resultwf.NewItem("First result!")// Send results to Alfredwf.SendFeedback()}funcmain() {// Wrap your entry point with Run() to catch and log panics and// show an error in Alfred instead of silently dyingwf.Run(run)}

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

./program"$1"

Documentation

Read the docson pkg.go.dev.

Check out theexample workflows (docs), whichshow how to use AwGo. Use one as a template to get your own workflow up andrunning quickly.

Requirements

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

This means that if you want to run AwGo-based code outside Alfred, e.g. in yourshell, you must set at least the following environment variables to meaningfulvalues, 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
  • alfred_version (not needed for Alfred 4+)

Development

To create a sufficiently Alfred-like environment, you cansource theenv.shscript in the project root or run unit tests via therun-tests.sh script(which also sets up an appropriate environment before callinggo test).

Licensing & thanks

This library is released under theMIT licence. It was built withneovim andGoLand by JetBrains.

The icon is based on theGo Gopher byRenee French.


[8]ページ先頭

©2009-2025 Movatter.jp