Pennyworth is a command line interface and the perfect companion to Alfred. With Pennyworth, you can unlock the full potential of the Ruby language by leveraging a modern version of Ruby through Alfred Workflows. Perfect for when you want to advance beyond the basic workflows Alfred provides by default.
- Command Line Interface (CLI)
- Code of Conduct
While using a Ruby Version Manager is not a hard requirement, it is strongly encouraged since a version manager will give you the freedom to toggle between different Ruby versions since this gem has strict Ruby version requirements (especially in regards to using a modern version of Ruby).
All of the workflows, scripts, examples for this gem use Bash syntax. That said, if you are comfortable with translating Bash syntax to your shell syntax of choice, you can make this gem work in different shells too. That is beyond the scope of this document, though, so leave that exercise up to you.
To install, run:
gem install pennyworth
When using the
--git_hub CLI option, you’ll want to supply your GitHub login and
Personal Access Token with at least read access via the
following environment variables:
You can configure these environment variables via direnv if using the CLI or through the Alfred Workflow Environment.
⚠️ When using Alfred Workflow environment variables, please ensure you check the Don’t Export option for these variables so you don’t expose your credentials when exporting/sharing workflows with others.
Command Line Interface (CLI)
From the command line, type
pennyworth to view usage:
Pennyworth - A command line interface that augments Alfred workflows. USAGE: -c, --config ACTION Manage gem configuration. Actions: edit || view. --encodings Render Alfred encodings script filter. --git_hub Render Alfred GitHub repositories script filter. -h, --help Show this message. --http_statuses Render Alfred HTTP statuses script filter. --ruby_gems Render Alfred RubyGems script filter. --standard_errors Render Alfred standard errors script filter. --system_errors Render Alfred system errors script filter. --system_signals Render Alfred system signals script filter. --text CONTENT Render Alfred text script filter. -v, --version Show gem version. GITHUB OPTIONS: --organization [HANDLE] Set organization. Default: "". --user [HANDLE] Set user. Default: "". RUBYGEMS OPTIONS: --owner [HANDLE] Set owner. Default: "".
The following demonstrates how to use Pennyworth from the CLI or within an Alfred Script Filter:
pennyworth --config edit pennyworth --config view pennyworth --encodings pennyworth --git_hub --organization alchemists pennyworth --git_hub --user bkuhlmann pennyworth --http_statuses pennyworth --ruby_gems --owner bkuhlmann pennyworth --standard_errors pennyworth --system_errors pennyworth --system_signals pennyworth --text demo pennyworth --text "An Example"
While the command line options are nice, the real power comes from using Pennyworth in conjunction with Alfred Script Filters. Without having Alfred wired up to consume the CLI output, you’ll only get a JSON in your console. To explain better, continue reading or skip ahead to the Workflows section.
This gem can be configured via a global configuration:
It can also be configured via XDG environment variables.
The default configuration is as follows:
:alfred: :preferences: :inflections: - "Bkuhlmann": "bkuhlmann" - "Dry Auto Inject": "Dry AutoInject" - "Dry Cli": "Dry CLI" - "Flacsmith": "FLACsmith" - "Git Plus": "Git+" - "Http Fake": "HTTP Fake" - "Mac Os Config": "macOS Configuration" - "Mac Os": "MacOS" - "Pkce": "PKCE" - "Prawn Plus": "Prawn+" - "Rubocop Ast": "Rubocop AST" - "Rubocop Md": "Rubocop Markdown" - "Rubocop Rspec": "Rubocop RSpec" - "Tty Box": "TTY Box" - "Tty Color": "TTY Color" - "Tty Command": "TTY Command" - "Tty Config": "TTY Config" - "Tty Cursor": "TTY Cursor" - "Tty Editor": "TTY Editor" - "Tty File": "TTY File" - "Tty Font": "TTY Font" - "Tty Link": "TTY Link" - "Tty Logger": "TTY Logger" - "Tty Markdown": "TTY Markdown" - "Tty Option": "TTY Option" - "Tty Pager": "TTY Pager" - "Tty Pie": "TTY Pie" - "Tty Platform": "TTY Platform" - "Tty Progressbar": "TTY ProgressBar" - "Tty Prompt": "TTY Prompt" - "Tty Reader": "TTY Reader" - "Tty Screen": "TTY Screen" - "Tty Spinner": "TTY Spinner" - "Tty Table": "TTY Table" - "Tty Tree": "TTY Tree" - "Tty Which": "TTY Which" - "Xdg": "XDG" :git_hub: :api_url: "https://api.github.com" :organization: :user: :http: :statuses: :url: "https://developer.mozilla.org/docs/Web/HTTP/Status" :ruby_gems: :api_url: "https://rubygems.org/api/v1" :owner:
Feel free to take this default configuration, modify, and save as your own custom
The above is shared as the Alchemists Alfred Theme which can be installed directly.
Not all workflows require Pennyworth to run properly (see the Other section below for details). For the workflows that do require Pennyworth support, the following assumptions are made:
Your Dotfiles are configured to use Bash and load your environment appropriately. Bash is not a hard requirement, though. You can use any shell you are comfortable with as long as you teach Alfred to load your development environment before running the Alfred Workflow.
You have the latest version of Alfred, Ruby, and Pennyworth installed.
You are using a Ruby Version Manager which ensures Ruby is on your load path. As mentioned in the Requirements section above, this is not a hard requirement so if you have the correct version of Ruby required by this gem on your path, that’ll work too.
With the above requirements in mind, the following sections document how to download and install all Pennyworth workflows that are compatible with Alfred. Should you want to tweak any of these workflows, you’d only need to edit an existing workflow or build your own with these settings:
Before diving into each workflow, I want to highlight that the following capabilities are available to all workflows depending on what kind of item is currently selected within the Alfred UI:
COMMAND + ywill launch Quicklook for any URL based workflow.
COMMAND + cwill copy selections to clipboard (depends on context, though).
COMMAND + lwill launch Large Type of current selection.
ENTERWill either copy selection to clipboard or launch URL in default web browser.
Provides quick access to Alchemists resources.
Provides quick access to Dry RB resources.
Provides quick access to RuboCop resources.
Provides quick access to Ruby resources.
The following workflows don’t require this gem to use but are provided for convenience in case they are of aid to your own productivity.
Expands acronyms so you can think and type in terms of an acronym but appear as if you typed out the full definition each time.
Provides quick access to Alpine Linux resources.
Launches your engineering environment but can be tweaked to your preferences. Using Alfred in this manner ensures your machine boots quickly so you have more control over what is launched.
Provides quick access to Bash resources.
Provides biographical calculations and information.
Provides quick access to browser resources.
Provides quick access to Bundler related resources.
Provides quick access to Circle CI resources.
Provides quick access to Crystal resources.
Provides quick access to CSS resources.
Provides quick access to Docker resources.
Provides quick access to Elm resources.
Provides quick access to Farnam Street resources.
Provides quick access to Git resources.
Provides quick access to GitHub resources.
Provides quick access to the Hanami web framework.
Provides quick access to the HTML language.
Internet Protocol (IP)
Provides quick access to IP tooling and resources.
Provides quick access to Jitsi resources.
Provides quick access to macOS resources.
Provides quick access to Rack resources.
Provides quick access to the Roda web framework.
Provides quick access to Ruby Object Mapper (ROM) resources.
Provides quick access to RSpec resources.
Ruby on Rails
Provides access to the Ruby on Rails web framework.
Provides quick access to search resources.
Provides quick access to Slack resources.
Provides quick access to SSL resources for the security conscious.
Provides quick access to Terraform resources.
Provides general text manipulation utilities beyond the Pennyworth powered text macro which is part of the Ruby workflow (mentioned earlier).
Psych 4.0.0 has a bug which prevents loading of YAML configurations that use symbols as keys. If you get caught by this, please upgrade to Psych 4.0.1 for the fix.
When your Alfred Workflow yields no output, you might want to open the Alfred Debugger, rerun your workflow, and check for errors. You can also jump to the CLI and run Pennyworth directly.
If you get GitHub authorization errors, make sure you have defined the appropriate credentials (mentioned earlier) for both within your shell where you are running Pennyworth or within the Alfred Workflow environment.
To contribute, run:
git clone https://github.com/bkuhlmann/pennyworth cd pennyworth bin/setup
You can also use the IRB console for direct access to all objects:
The following documents the workflow used to process all actions from Alfred.
To test, run:
Built with Gemsmith.
Engineered by Brooke Kuhlmann.