crates.alfredworkflow icon indicating copy to clipboard operation
crates.alfredworkflow copied to clipboard

📦 Alfred workflow to search Rust crates

crates.alfredworkflow

Build Status Latest Release

📦 Alfred workflow to search Rust crates.

Screenshot

Features

  • Search for crates by name.
  • Open the crate in the default browser. You can use modifiers to change the URL that is navigated to.
    • : opens the crate in https://crates.io.
    • ⌥ ⏎: opens the crate in https://lib.rs.
    • ⇧ ⏎: opens the crate in https://docs.rs.
  • Manages a local Crates.io index.
  • Shortcuts for std, core, and alloc crates.
  • Blazingly fast 🤸.

📦 Installation

Pre-packaged

Grab the latest release from the releases page.

Because the release contains an executable binary later versions of macOS will mark it as untrusted and Alfred won't be able to execute it. You can run the following to explicitly trust the release before installing to Alfred.

xattr -c ~/Downloads/crates-*-x86_64-apple-darwin.alfredworkflow

Building from source

This workflow is written in Rust, so to install it from source you will first need to install Rust and Cargo using rustup. Then install powerpack. Then you can run the following to build an .alfredworkflow file.

git clone https://github.com/rossmacarthur/crates.alfredworkflow.git
cd crates.alfredworkflow
powerpack package

The release will be available at target/workflow/crates.alfredworkflow.

Configuration

The workflow will automatically maintain a local index crates.io index. The index will be stored in the workflow cache directory. The update frequency can be configured be setting the index update interval.

Debugging

If you are experiencing issues you can debug the workflow in the following way:

  1. Inspect the output of the workflow by enabling debug mode in Alfred for the workflow.

  2. The index is maintained asynchronously and will output any updates and errors to a log file in the Alfred cache directly under the bundle name io.macarthur.ross.crates. The default Alfred cache directory is ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow\ Data/io.macarthur.ross.crates. Expected logs will look like the following.

[2022-01-31T11:10:24] [INFO] updated index ./crates.io-index: HEAD is now at 603fff76b2 Updating crate `midpoint#0.1.2`
[2022-02-04T15:06:07] [INFO] updated index ./crates.io-index: HEAD is now at 93d0942359 Updating crate `os_info_cli#2.0.0`
[2022-02-06T14:41:29] [INFO] updated index ./crates.io-index: HEAD is now at 5864e33978 Updating crate `agsol-gold-bot#0.0.0-alpha.2`
  1. Open an issue on this repo.

License

This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.