Skip to content

A command line interface for augmented Alfred workflows.

License

Notifications You must be signed in to change notification settings

bkuhlmann/pennyworth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pennyworth

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

  • Adds Ruby support to Alfred.

  • Supports building advanced Workflows for personal augmentation.

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:

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.

Themes

Alchemists Theme

The above is shared as the Alchemists Alfred Theme which can be installed directly.

Workflows

All workflows are split into two categories:

For workflows that do require Ruby and this gem, the following assumptions are made:

  1. 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.

  2. You have the latest version of Alfred, Ruby, and this gem installed.

  3. 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:

Script Filter

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 or COMMAND + y will launch Quicklook for any URL based workflow.

  • ENTER or COMMAND + 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

Alchemists Projects

Provides quick access to Alchemists resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Dry RB

Dry Gems

Provides quick access to Dry RB resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

htmx

htmx workflow screenshot.

Provides quick access to the htmx JavaScript library.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

RuboCop

Rubocop Projects

Provides quick access to RuboCop resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Ruby

Ruby workflow screenshot

Provides quick access to Ruby resources.

  1. Download and double click to install.

  2. 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

Acronyms workflow screenshot.

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.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Alpine

Alpine Linux workflow screenshot.

Provides quick access to Alpine Linux resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Applications

Applications workflow screenshot.

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.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Bash

Bash workflow screenshot.

Provides quick access to Bash resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Bio

Bio workflow screenshot.

Provides biographical calculations and information.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Browsers

Browsers workflow screenshot.

Provides quick access to browser resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Bundler

Bundler workflow screenshot.

Provides quick access to Bundler related resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Circle CI

Circle CI workflow screenshot.

Provides quick access to Circle CI resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Crystal

Crystal workflow screenshot.

Provides quick access to Crystal resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

CSS

CSS workflow screenshot.

Provides quick access to CSS resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Docker

Docker workflow screenshot.

Provides quick access to Docker resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Elm

Elm workflow screenshot.

Provides quick access to Elm resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Farnam Street

Farnam Street workflow screenshot.

Provides quick access to Farnam Street resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Git

Git workflow screenshot.

Provides quick access to Git resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

GitHub

GitHub workflow screenshot.

Provides quick access to GitHub resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Hanami

Hanami workflow screenshot.

Provides quick access to the Hanami web framework.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

HTML

HTML workflow screenshot.

Provides quick access to the HTML language.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Icon

Icon workflow screenshot.

Provides quick access to icon resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Internet Protocol (IP)

IP workflow screenshot.

Provides quick access to IP tooling and resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Jitsi

Jitsi workflow screenshot.

Provides quick access to Jitsi resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

macOS

macOS workflow screenshot.

Provides quick access to macOS resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

PostgreSQL

PostgreSQL workflow screenshot.

Provides quick access to PostgreSQL resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Rack

Rack workflow screenshot.

Provides quick access to Rack resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Roda

Roda workflow screenshot.

Provides quick access to the Roda web framework.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

ROM

ROM workflow screenshot.

Provides quick access to Ruby Object Mapper (ROM) resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

RSpec

RSpec workflow screenshot.

Provides quick access to RSpec resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Ruby on Rails

Ruby on Rails workflow screenshot.

Provides access to the Ruby on Rails web framework.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Search workflow screenshot.

Provides quick access to search resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Slack

Slack workflow screenshot.

Provides quick access to Slack resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

SSL

SSL workflow screenshot.

Provides quick access to SSL resources for the security conscious.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Tana

Tana workflow screenshot.

Provides quick access to Tana resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Terraform

Terraform workflow screenshot.

Provides quick access to Terraform resources.

  1. Download and double click to install.

  2. Click on Configure Workflow to view documentation.

Text

Text workflow screenshot.

Provides general text manipulation utilities beyond the Pennyworth powered text macro which is part of the Ruby workflow (mentioned earlier).

  1. Download and double click to install.

  2. 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.

Architecture Diagram

Tests

To test, run:

bin/rake

Credits

About

A command line interface for augmented Alfred workflows.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages