chrisallenlane/cheat — pull request #24 by jlund3 (2013-08-20 23:26:51+00:00)
Title: Using pkg_resources to access cheatsheet as package data.

First off, let me just say that I love the idea of the cheat command. Thanks for putting this together.

Anyways, I cloned your repository and ran "sudo python setup.py install" and expected to be able to run "cheat" out of the box, but instead got the error message "The ~/.cheat dir does not exists or the CHEATPATH var is not set."

The reason was apparent when I looked at the code. You were trying to import cheatsheets, but it did not have a __init__.py, meaning it wasn't being treated as a package. Furthermore, even after adding the init file, you would have seen an attribute error since cheat_dir is not an attribute of the non-existent cheatsheets package.

This patch fixes this by creating the cheatlib package (you may change that name, but I thought it might be nice to have a library the cheat script can call for any future development). The cheat script then uses pkg_resources to get the package data correctly.

If you have any further questions, please let me know.

-jlund3