{"id":13582063,"url":"https://github.com/drgrib/alfred","last_synced_at":"2025-07-21T10:34:16.716Z","repository":{"id":48172884,"uuid":"139768818","full_name":"drgrib/alfred","owner":"drgrib","description":"A fast, simple way to make Alfred workflow script filters in Go","archived":false,"fork":false,"pushed_at":"2024-01-23T18:11:05.000Z","size":204,"stargazers_count":35,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T16:52:22.738Z","etag":null,"topics":["alfred","alfred-workflow","alfred3","alfred3-workflow","go","golang","workflow"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drgrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"drgrib"}},"created_at":"2018-07-04T21:54:11.000Z","updated_at":"2025-06-17T13:40:17.000Z","dependencies_parsed_at":"2024-01-23T19:30:02.183Z","dependency_job_id":"9638234e-7595-4703-9cb4-3981cbdc698a","html_url":"https://github.com/drgrib/alfred","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/drgrib/alfred","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drgrib%2Falfred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drgrib%2Falfred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drgrib%2Falfred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drgrib%2Falfred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drgrib","download_url":"https://codeload.github.com/drgrib/alfred/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drgrib%2Falfred/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266285573,"owners_count":23905382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alfred","alfred-workflow","alfred3","alfred3-workflow","go","golang","workflow"],"created_at":"2024-08-01T15:02:24.701Z","updated_at":"2025-07-21T10:34:16.697Z","avatar_url":"https://github.com/drgrib.png","language":"Go","funding_links":["https://github.com/sponsors/drgrib"],"categories":["Go"],"sub_categories":[],"readme":"# Easy Alfred Workflow Script Filters in Go\n\n[![GoDoc][godoc-icon]][godoc-link]\n\nThis is a lean but [comprehensive](full-json.md) implementation of the Alfred Script Filter JSON Format to get Alfred workflows off the ground quickly with blazingly fast script filters in Go that can be seamlessly developed inside or outside Alfred. \n\nIt uses standard, familiar Go syntax and conventions as much as possible for rapid use by Go developers and integration with other Go code.\n\n## Installation\n\n```\ngo get github.com/drgrib/alfred\n```\n\n## Full Alfred JSON Support\n[full-json.md](full-json.md) has examples of how to produce the full range of JSON output for Alfred's Script Filter JSON Format.\n\n## A Simple Example\nLet's say we want to create a simple script filter that converts a given query to title case, lower case, or upper case, for which Go conveniently has built-in support.\n\nLet's start by prototyping our logic in Go with a `case.go` file in our workflow folder. We can do this on the command line or in the editor of our choice and easily run it inside or outside of Alfred:\n\n``` go\npackage main\n\nimport (\n\t\"strings\"\n\n\t\"github.com/drgrib/alfred\"\n)\n\nfunc addCases(arg string) {\n\ttitlecase := strings.Title(arg)\n\talfred.Add(alfred.Item{\n\t\tTitle:    titlecase,\n\t\tSubtitle: \"Title\",\n\t\tArg:      titlecase,\n\t\tUID:      \"titlecase\",\n\t})\n\n\tlowercase := strings.ToLower(arg)\n\talfred.Add(alfred.Item{\n\t\tTitle:    lowercase,\n\t\tSubtitle: \"Lower\",\n\t\tArg:      lowercase,\n\t\tUID:      \"lowercase\",\n\t})\n\n\tuppercase := strings.ToUpper(arg)\n\talfred.Add(alfred.Item{\n\t\tTitle:    uppercase,\n\t\tSubtitle: \"Upper\",\n\t\tArg:      uppercase,\n\t\tUID:      \"uppercase\",\n\t})\n}\n\nfunc main() {\n\targ := \"just a test\"\n\taddCases(arg)\n\talfred.Run()\n}\n```\n``` json\n{\n    \"items\": [\n        {\n            \"uid\": \"title\",\n            \"title\": \"Just A Test\",\n            \"subtitle\": \"Title\",\n            \"arg\": \"Just A Test\"\n        },\n        {\n            \"uid\": \"lower\",\n            \"title\": \"just a test\",\n            \"subtitle\": \"Lower\",\n            \"arg\": \"just a test\"\n        },\n        {\n            \"uid\": \"upper\",\n            \"title\": \"JUST A TEST\",\n            \"subtitle\": \"Upper\",\n            \"arg\": \"JUST A TEST\"\n        }\n    ]\n}\n```\n\nLooks good. Now let's add `os.Args` support and test it on the command line to simulate Alfred input:\n\n``` go\npackage main\n\nimport (\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/drgrib/alfred\"\n)\n\n// [same stuff in the middle]\n\nfunc main() {\n\targ := os.Args[1]\n\taddCases(arg)\n\talfred.Run()\n}\n```\n``` bash\ngo build case.go\n./case \"another test\"\n```\n``` json\n{\n    \"items\": [\n        {\n            \"uid\": \"title\",\n            \"title\": \"Another Test\",\n            \"subtitle\": \"Title\",\n            \"arg\": \"Another Test\"\n        },\n        {\n            \"uid\": \"lower\",\n            \"title\": \"another test\",\n            \"subtitle\": \"Lower\",\n            \"arg\": \"another test\"\n        },\n        {\n            \"uid\": \"upper\",\n            \"title\": \"ANOTHER TEST\",\n            \"subtitle\": \"Upper\",\n            \"arg\": \"ANOTHER TEST\"\n        }\n    ]\n}\n```\n\nRight again. Alright. Now let's drop this into our script filter:\n\n\u003cimg src=\"./images/1-script-filter.png\" alt=\"script-filter\"\u003e\n\nAnd give it a whirl:\n\n\u003cimg src=\"./images/2-test.png\" alt=\"test\"\u003e\n\nWhy not copy these to the clipboard so we can actually use them?\n\n\u003cimg src=\"./images/3-clipboard.png\" alt=\"clipboard\"\u003e\n\nWith a few simple runs and a glance at the Alfred clipboard history, we can see we are ready for business:\n\n\u003cimg src=\"./images/4-history.png\" alt=\"clipboard\"\u003e\n\nEasy!\n\n[godoc-icon]: https://godoc.org/github.com/drgrib/alfred?status.svg\n[godoc-link]: https://godoc.org/github.com/drgrib/alfred","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrgrib%2Falfred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrgrib%2Falfred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrgrib%2Falfred/lists"}