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.
Features
Screencast
Requirements
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. Shell conversion is beyond the scope of this document so leave that exercise to you.
Setup
To install with security, run:
# 💡 Skip this line if you already have the public certificate installed.
gem cert --add <(curl --compressed --location https://alchemists.io/gems.pem)
gem install pennyworth --trust-policy HighSecurity
To install without security, 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:
GITHUB_API_LOGIN=
GITHUB_API_TOKEN=
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.
Usage
Command Line Interface (CLI)
From the command line, type pennyworth
to view usage:
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.
Customization
This gem can be configured via a global configuration:
~/.config/pennyworth/configuration.yml
It can also be configured via XDG environment variables.
The default configuration is as follows:
inflections:
- "Base64": "Base64"
- "Bigdecimal": "BigDecimal"
- "Cgi": "CGI"
- "Cmath": "CMath"
- "Csv": "CSV"
- "Dbm": "DBM"
- "Drb": "Distributed Ruby"
- "Dry Auto Inject": "Dry AutoInject"
- "Dry Cli": "Dry CLI"
- "E2mmap": "Exception to Message Mapper"
- "Erb": "ERB"
- "Fileutils": "File Utilities"
- "Gdbm": "GDBM"
- "Getoptlong": "Get Option Long"
- "Http Fake": "HTTP Fake"
- "Io Console": "IO Console"
- "Io Nonblock": "IO Nonblock"
- "Io Wait": "IO Wait"
- "Ipaddr": "IP Address"
- "Irb": "IRB"
- "Irb Kit": "IRB Kit"
- "Json": "JSON"
- "Mac Os Config": "macOS Configuration"
- "Mac Os": "MacOS"
- "Net Ftp": "Net FTP"
- "Net Http": "Net HTTP"
- "Net Imap": "Net IMAP"
- "Net Pop": "Net POP"
- "Net Smtp": "Net SMTP"
- "Nkf": "NKF"
- "Open Uri": "OpenURI"
- "Openssl": "OpenSSL"
- "Optparse": "Option Parser"
- "Ostruct": "OpenStruct"
- "Pkce": "PKCE"
- "Pp": "PP"
- "Prawn Plus": "Prawn+"
- "Prettyprint": "Pretty Print"
- "Pstore": "PStore"
- "Rbs": "RBS"
- "Rdoc": "RDoc"
- "Rexml": "REXML"
- "Rss": "RSS"
- "Rubocop Ast": "RuboCop AST"
- "Rubocop Capybara": "RuboCop Capybara"
- "Rubocop Factory Bot": "RuboCop FactoryBot"
- "Rubocop Md": "RuboCop Markdown"
- "Rubocop Performance": "RuboCop Performance"
- "Rubocop Rails": "RuboCop Rails"
- "Rubocop Rake": "RuboCop Rake"
- "Rubocop Rspec": "RuboCop RSpec"
- "Rubocop Sequel": "RuboCop Sequel"
- "Rubocop Thread Safety": "RuboCop Thread Safety"
- "Rubocop": "RuboCop"
- "Ruby2_keywords": "Ruby to Keywords"
- "Rubygems": "RubyGems"
- "Sdbm": "SDBM"
- "Securerandom": "Secure Random"
- "Stringio": "String IO"
- "Strscan": "String Scan"
- "Tempfile": "Temporary File"
- "Thwait": "Threads Wait"
- "Tmpdir": "Temporary Directory"
- "Tsort": "TSort"
- "Typeprof": "Type Profiler"
- "Un": "un"
- "Uri": "URI"
- "Weakref": "Weak Reference"
- "Win32ole": "Windows 32 OLE"
- "Xdg": "XDG"
- "Xmlrpc": "XMLRPC"
- "Yaml": "YAML"
git_hub:
api_url: "https://api.github.com"
http:
statuses:
url: "https://developer.mozilla.org/docs/Web/HTTP/Status"
htmx:
examples_uri: "%<htmx_site_uri>s/examples"
extensions_uri: "%<htmx_site_uri>s/extensions"
references_uri: "%<htmx_site_uri>s/reference"
site_uri: "https://htmx.org"
ruby_gems:
api_url: "https://rubygems.org/api/v1"
standard_gems:
api_url: "https://stdgems.org"
Feel free to take this default configuration, modify, and save as your own custom
configuration.yml
.
For htmx, the Ruby String Format specification is used which means you can define the site_uri
once and have it automatically resolved in all URIs that reference it. Otherwise, you can use literal URIs if desired.
Workflows
All workflows are split into two categories:
For workflows that do require Ruby and this gem, 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 this gem installed.
-
You are using a Ruby Version Manager which ensures Ruby is on your load path. As mentioned in the Requirements, 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 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:
-
SHIFT
orCOMMAND + y
will launch Quicklook for any URL based workflow. -
ENTER
orCOMMAND + c
will copy selections to clipboard (depends on context, though). -
COMMAND + l
will launch Large Type of current selection. -
ENTER
Will either copy selection to clipboard or launch URL in default web browser.
Ruby Required
The following workflows require Ruby — and this gem — to unleash all capabilities.
Alchemists
Provides quick access to Alchemists resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Dry RB
Provides quick access to Dry RB resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
htmx
Provides quick access to the htmx JavaScript library.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Ruby Optional
The following workflows don’t require Ruby — or this gem — to use but are provided for convenience in case they can augment your own workflow further.
Acronyms
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.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Alpine
Provides quick access to Alpine Linux resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Applications
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.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Bash
Provides quick access to Bash resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Bio
Provides biographical calculations and information.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Browsers
Provides quick access to browser resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Bundler
Provides quick access to Bundler related resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Circle CI
Provides quick access to Circle CI resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Crystal
Provides quick access to Crystal resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
CSS
Provides quick access to CSS resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Docker
Provides quick access to Docker resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Elm
Provides quick access to Elm resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Farnam Street
Provides quick access to Farnam Street resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Git
Provides quick access to Git resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
GitHub
Provides quick access to GitHub resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Hanami
Provides quick access to the Hanami web framework.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
HTML
Provides quick access to the HTML language.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Icon
Provides quick access to icon resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Internet Protocol (IP)
Provides quick access to IP tooling and resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Jitsi
Provides quick access to Jitsi resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
macOS
Provides quick access to macOS resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
PostgreSQL
Provides quick access to PostgreSQL resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Rack
Provides quick access to Rack resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Roda
Provides quick access to the Roda web framework.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
ROM
Provides quick access to Ruby Object Mapper (ROM) resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
RSpec
Provides quick access to RSpec resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Ruby on Rails
Provides access to the Ruby on Rails web framework.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Search
Provides quick access to search resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Slack
Provides quick access to Slack resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
SSL
Provides quick access to SSL resources for the security conscious.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Tana
Provides quick access to Tana resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Terraform
Provides quick access to Terraform resources.
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Text
Provides general text manipulation utilities beyond the Pennyworth powered text macro which is part of the Ruby workflow (mentioned earlier).
-
Download and double click to install.
-
Click on Configure Workflow to view documentation.
Troubleshooting
-
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.
Development
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:
bin/console
Architecture
The following documents the workflow used to process all actions from Alfred.
Tests
To test, run:
bin/rake
Credits
-
Built with Gemsmith.
-
Engineered by Brooke Kuhlmann.