Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
Utility lib to create items in JSON format for Alfred
Add this to your application's shard.yml
:
dependencies:
alfred:
github: International/crystal-alfred
At this moment, the only supported format is JSON.
require "alfred"
response = Alfred::Response.new
response << Alfred::Item.new("title", "subtitle", "arg", Alfred::Icon.new("icon","icon.png"))
puts response.to_json
# {"items":[{"title":"title","subtitle":"subtitle","arg":"arg","icon":{"type":"icon","path":"icon.png"}}]}
When using Alfred::Item
, probably the parameter you'll most likely be interested in is arg
.
This is the parameter that gets sent further when you select an item from the list.