https://github.com/rossmacarthur/powerpack
⚡ Supercharge your Alfred workflows by building them in Rust!
https://github.com/rossmacarthur/powerpack
alfred alfred-workflow crate rust
Last synced: 27 days ago
JSON representation
⚡ Supercharge your Alfred workflows by building them in Rust!
- Host: GitHub
- URL: https://github.com/rossmacarthur/powerpack
- Owner: rossmacarthur
- License: apache-2.0
- Created: 2021-03-31T08:49:01.000Z (over 4 years ago)
- Default Branch: trunk
- Last Pushed: 2025-09-03T08:05:16.000Z (about 1 month ago)
- Last Synced: 2025-09-03T09:29:48.606Z (about 1 month ago)
- Topics: alfred, alfred-workflow, crate, rust
- Language: Rust
- Homepage:
- Size: 197 KB
- Stars: 54
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# ⚡ powerpack
[](https://crates.io/crates/powerpack)
[](https://docs.rs/powerpack)
[](https://github.com/rossmacarthur/powerpack/actions/workflows/build.yaml?query=branch%3Atrunk)Supercharge your [Alfred 🎩][alfred] workflows by building them in Rust 🦀!
[alfred]: https://www.alfredapp.com
## 🚀 Getting started
This project contains a `powerpack` crate which provides types for developing
script filter Alfred workflows in Rust as well as various utilities that make it
easier to build workflows. It also provides a command line tool to initialize,
build, and install workflows built using the `powerpack` crate.Firstly, install the command line tool.
```sh
cargo install powerpack-cli
```Now create a new project using a similar API as `cargo new` or `cargo init`.
```sh
powerpack new myworkflow && cd myworkflow
```This will create a new Rust project as well as a `workflow/` directory
containing information about your Alfred workflow. The following will create
a release build of the workflow and copy it to the `workflow/` directory.
```sh
powerpack build --release
```Now you can link it to Alfred. The following will symlink the `workflow/`
directory to the Alfred preferences folder.
```sh
powerpack link
```Now you can run the workflow from Alfred ✨!
To package a `.alfredworkflow` file for release you can run the following.
```sh
powerpack package
```The release will be available at `target/workflow/myworkflow.alfredworkflow`.
## 🤸 Usage
The following is a "Hello World!" Alfred workflow built using `powerpack`.
```rust
use std::env;
use std::error::Error;
use std::iter;fn main() -> Result<(), Box> {
// Alfred passes in a single argument for the user query.
let arg = env::args().nth(1);
let query = arg.as_deref().unwrap_or("");// Create an item to show in the Alfred drop down.
let item = powerpack::Item::new("Hello World!")
.subtitle(format!("Your query was '{}'", query));// Output the item to Alfred!
powerpack::output(iter::once(item))?;Ok(())
}
```This would render an item as shown.

## 👷 GitHub Action
[`setup-crate`][setup] can be used to install `powerpack` in a GitHub Actions
workflow. For example:
```yaml
steps:
- uses: actions/checkout@v2
- uses: extractions/setup-crate@v1
with:
repo: rossmacarthur/powerpack
- run: powerpack package
# produces an artifact at `target/workflow/{name}.alfredworkflow`
```[setup]: https://github.com/extractions/setup-powerpack
## 💡 Examples
The following projects are built using `powerpack`.
- [crates.alfredworkflow](https://github.com/rossmacarthur/crates.alfredworkflow)
- [github.alfredworkflow](https://github.com/rossmacarthur/github.alfredworkflow)
- [gitlab.alfredworkflow](https://github.com/rossmacarthur/gitlab.alfredworkflow)## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.