Jump to content

awf - a helper CLI for managing and assisting in the development of workflows


Recommended Posts

Note: This is not a workflow, but a helper CLI (command-line utility) geared toward Alfred users who manage development of multiple workflows intended for sharing.

 

I suggest installing via the npm registry, if you have Node.js installed - if not, consider installing it just to benefit from its great package manager, npm; try curl -L http://git.io/n-install | bash  ):    
 
[sudo] npm install -g awf

Alternatively, here are instructions for manual installation.

Note, however, that the npm-based installation makes updating to a newer version much easier.

 
Below is a high-level overview; you can find the full manual in the repo's Usage chapter, or, once installed, you can execute  awf help (concise overview), awf help all (full manual), or awf help <sub-command>.

 

------

 

awf (Alfred Workflow) is an OS X CLI for managing and assisting in the development of workflows for command-line launcher Alfred 2.

 

It comes with a broad range of features:

 

Note: Some features related to Alfred Preferences.app involve GUI scripting and therefore require that the application running awf - typically, Terminal.app - be granted access to accessibility features - you will be prompted for authorization on first use; for more information, see Apple’s support article on the subject.

 

Retrieving information about workflows

  • List all workflows or workflows matching a filter, optionally with selectable output fields.
    • awf list -s i net.same2u. # list matching workflows by bundle ID substring
  • Print information about a given workflow.
    • awf info net.same2u.speak.awf

Locating workflows

  • Locate a workflow’s installation folder by its bundle ID.
    • awf which net.same2u.speak.awf # prints installation folder path
  • Reveal a workflow’s folder in Finder.
    • awf reveal net.same2u.speak.awf
  • Trigger a keyword search for workflows in Alfred Preferences.
    • awf search speak

Editing workflows

  • Change to a workflow’s folder in Terminal.
    • awf cd net.same2u.speak.awf # opens a tab in a new window
  • Open a workflow in Alfred Preferences for editing.
    • awf edit net.same2u.speak.awf
    • awf edit # from a workflow source folder

Installing and exporting workflows

  • Install a (copy of a) workflow from a source folder.
    • awf install .
  • Export a *.alfredworkflow archive from a source folder.
    • awf export . # exports to '*.alfredworkflow' in same folder by default

Developing workflows

Note:

  • The purpose of the following features is to allow you to store workflows being developed in a separate location instead of directly among the installed workflows. A symlink to the dev location placed among the installed folders ensures that you can still use and develop the workflow from within Alfred and Alfred Preferences.
  • These features move directories, create symlinks, and delete files. Care is taken not to accidentally overwrite or delete files, but use these features with caution and always create backups.

 

  • Symlink a dev folder (source folder) into the folder of installed worklows or remove a dev folder’s symlink.
    • awf link . # effective installation without moving the directory
    • awf unlink . # remove a symlink - effective uninstallation
  • Move an existing, regular workflow to a dev folder in a different location and replace the original workflow folder with a symlink to the dev folder.
    • awf todev net.same2u.speak . # move to current folder and perform 'awf link'
  • Conversely, move a dev folder back to the folder of installed workflows as a regularly installed workflow.
    • awf fromdev . # -k keeps the source folder
  • Manage workflow version numbers via file version.
    • awf version patch # bumps the patch component of the workflow's version number
Edited by mklement0
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...