Alpaca is a command line utility for building Alfred workflow bundles.
An alpaca project is an alpaca.yml
file that defines the workflow, alongside any supporting files, such as scripts or images.
Note: Alpaca is still in the proof-of-concept phase. Huge portions of Alfred functionality are unimplemented.
Contents
Download the latest release, or:
$ go get github.com/jclem/alpaca
Pack an Alpaca project into an Alfred workflow. The workflow will be output into the current directory.
$ alpaca pack .
This workflow uses a trigger "say" to say words passed as arguments. For example, the user might type "say hello world" into Alfred.
name: Say
objects:
trigger:
type: keyword
config:
keyword: say
argument: required
then: say
say:
type: script
config:
script:
content: say {query}
type: bash
name
The name of the projectversion
The version of the projectauthor
The author of the project (i.e.Jonathan Clem <[email protected]>
)bundle-id
The Alfred workflow bundle IDdescription
A short description of the workflowreadme
A longer description of the workflow, seen when users import iturl
A homepage URL for the workflowicon
A project-relative path to an icon to use for the worflowvariables
A map of variable names and their default valuesobject
An map of objects in the Alfred workflow. Each key is an object name.
icon
A project-relative path to an icon for the objecttype
The type of object this is. Currently partial support exists for:config
A type-specific configuration object, see each type schema for detailsthen
A string, list of strings, or a list of objects representing other objects to connect to, each objects having this schema:object
The name of the object to connect to
cache
(bool
, defaulttrue
) Whether to cache the compiled AppleScriptcontent
(string
) The content of the AppleScript
text
(string
, default"{query}"
) The text to copy to the clipboard—use"{query}"
for the exact query
keyword
(string
) The keyword that triggers this objectwith-space
(bool
, defaulttrue
) Whether a space is required with this objecttitle
(string
) The title of the objectsubtitle
(string
) The subtitle of the objectargument
(string
) A string determining whether an argument is required. One of:required
The argument is requiredoptional
The argument is optionalnone
No argument is accepted
url
(string
) The URL to open. Use"{query}"
for the exact query
script
A script configuration object
argument
(string
) A string determining whether an argument is required. One of:required
The argument is requiredoptional
The argument is optionalnone
No argument is accepted
argument-trim
(string
) Whether to trim the argument's whitespace. One of:auto
Argument automatically trimmedoff
Argument not trimmed
escaping
([]string
) A list of strings to escape in the query text, if the script object'sarg-type
isquery
. Any of:spaces
backquotes
double-quote
brackets
semicolons
dollars
backslashes
ignore-empty-argument
(bool
) Whether an empty argument (whenarg-type
isargv
in script config) is omitted fromargv
(whenfalse
, it will be an empty string)keyword
(string
) The keyword that triggers this objectrunning-subtitle
(string
) A subtitle to display while this filter runssubtitle
(string
) A subtitle for this objecttitle
(string
) A title for this objectwith-space
(bool
, defaulttrue
) Whether a space is required with this objectalfred-filters-results
An object describing how Alfred filters results (it does not if this is omitted):mode
(string
) The mode Alfred uses to filter results. One of:exact-boundary
exact-start
word-match
run-behavior
An object describing behavior of the script runimmediate
(bool
) Whether to run immediately always for the first character typedqueue-mode
(string
) A mode for how script runs are queued. One of:wait
Wait for previous run to completeterminate
Terminate previous run immediately and start a new one
queue-delay
(string
) A delay mode for queueing script runs. One of:immediate
No delayautomatic
Automatic after last character typed100ms
100ms after last character typed200ms
200ms after last character typed300ms
300ms after last character typed400ms
400ms after last character typed500ms
500ms after last character typed600ms
600ms after last character typed700ms
700ms after last character typed800ms
800ms after last character typed900ms
900ms after last character typed1000ms
1000ms after last character typed
script
A script configuration object
There are a few types of script schemas possible, in addition to these options:
This version executes the script at the given path (it must be executable).
path
(string
) The path to the script
This version executes an inline script.
arg-type
(string
) The way the argument is passed to the script. One of:query
Interpolated as (query
)argv
Passed into process arguments
content
(string
) The content of the scripttype
(string
) The type of script, one of:bash
php
ruby
python
perl
zsh
osascript-as
osascript-js