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 then a variation of the same command in another.

A good example is when pushing code, we might run git push origin master for one repository, but for another, we might 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.

Usage

####You can either create the command and config file semi-automatically:

  1. Run:

     $ genie create <command>
    

    This will create a YAML file ~/.config/genie/<command>.yml and the command (a softlink) in the current directory.

  2. Move this softlink to a directory in your $PATH so that you can run the command anywhere.

     $ mv <command> /some/directory/included/in/path/
    

####Or, you can create them manually:

  1. Figure out where genie is installed.

     $ which genie
    
  2. Create a softlink to genie with a sensible name and make sure this softlink is in directory included in your $PATH. This will be your new command e.g.

     $ ln -s /full/path/to/genie/from/step1 <command>
    
  3. Create a YAML configuration file matching the softlink in your user directory’s .config/genie/ directory. e.g. For the command called push, you would create ~/.config/genie/push.yml.

Configuration

Either way, update the configuration file at ~/.config/genie/<command>.yml with commands for each directory.

Contents for the YAML file are key-value mappings from a directory path to the command to be ran in that directory (and its 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 run <command> edit (i.e. push edit) to open the command’s configuration file in the default editor.

Installation

gem install command-genie

License

BSD

Questions