As developers, we try to automate and build shortcuts to improve our workflow. Sometimes we always run the same command in a specific project directory and a slightly different command or the same command with slightly different parameters in another.
A good example is when pushing code, we might run
git push origin master for one repository, but for another, we might want to run
hub push origin,deploy master instead.
genie helps you do that.
genie lets you create commands that are bound to directories. In our example, we can create a
push command that, depending on which directory we run it in, invoke the correct push command.
Here's how to create a command with
Create a YAML configuration file matching the softlink in your user directory's
.configdirectory. e.g. For the command called
push, you would create
Contents for the YAML file are key-value mappings from a directory path to the command to be ran in that directory (and it's subdirectories):
/Users/hboon/code/piggyalarm: git push bb master /Users/hboon/code/simplymeta: hub push bb,deploy master ~/code/ligify: git push bb master
You can also run
genie create <command>to help you create a sample YAML file.
Create a softlink to
geniewith a sensible name and make sure it's in your $PATH, e.g.
ln -s genie push
gem install command-genie