diff --git a/cheat b/cheat index b6d122b..3e537bb 100755 --- a/cheat +++ b/cheat @@ -1,10 +1,16 @@ #!/usr/bin/env python + import os +import pkg_resources import sys # assembles a list of directories containing cheatsheets def cheat_directories(): paths = [os.path.expanduser('~/.cheat')] + try: + paths.append(pkg_resources.resource_filename('cheatlib', 'cheatsheets')) + except ImportError: + pass # cheatlib was not installed paths.extend(os.environ.get('CHEATPATH', '').split(os.pathsep)) return [path for path in paths if os.path.isdir(path)] diff --git a/cheatlib/__init__.py b/cheatlib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cheatsheets/apt-cache b/cheatlib/cheatsheets/apt-cache similarity index 100% rename from cheatsheets/apt-cache rename to cheatlib/cheatsheets/apt-cache diff --git a/cheatsheets/asterisk b/cheatlib/cheatsheets/asterisk similarity index 100% rename from cheatsheets/asterisk rename to cheatlib/cheatsheets/asterisk diff --git a/cheatsheets/bash b/cheatlib/cheatsheets/bash similarity index 100% rename from cheatsheets/bash rename to cheatlib/cheatsheets/bash diff --git a/cheatsheets/convert b/cheatlib/cheatsheets/convert similarity index 100% rename from cheatsheets/convert rename to cheatlib/cheatsheets/convert diff --git a/cheatsheets/cut b/cheatlib/cheatsheets/cut similarity index 100% rename from cheatsheets/cut rename to cheatlib/cheatsheets/cut diff --git a/cheatsheets/dhclient b/cheatlib/cheatsheets/dhclient similarity index 100% rename from cheatsheets/dhclient rename to cheatlib/cheatsheets/dhclient diff --git a/cheatsheets/find b/cheatlib/cheatsheets/find similarity index 100% rename from cheatsheets/find rename to cheatlib/cheatsheets/find diff --git a/cheatsheets/git b/cheatlib/cheatsheets/git similarity index 100% rename from cheatsheets/git rename to cheatlib/cheatsheets/git diff --git a/cheatsheets/ln b/cheatlib/cheatsheets/ln similarity index 100% rename from cheatsheets/ln rename to cheatlib/cheatsheets/ln diff --git a/cheatsheets/mysqldump b/cheatlib/cheatsheets/mysqldump similarity index 100% rename from cheatsheets/mysqldump rename to cheatlib/cheatsheets/mysqldump diff --git a/cheatsheets/netstat b/cheatlib/cheatsheets/netstat similarity index 100% rename from cheatsheets/netstat rename to cheatlib/cheatsheets/netstat diff --git a/cheatsheets/nmap b/cheatlib/cheatsheets/nmap similarity index 100% rename from cheatsheets/nmap rename to cheatlib/cheatsheets/nmap diff --git a/cheatsheets/notify-send b/cheatlib/cheatsheets/notify-send similarity index 100% rename from cheatsheets/notify-send rename to cheatlib/cheatsheets/notify-send diff --git a/cheatsheets/openssl b/cheatlib/cheatsheets/openssl similarity index 100% rename from cheatsheets/openssl rename to cheatlib/cheatsheets/openssl diff --git a/cheatsheets/scp b/cheatlib/cheatsheets/scp similarity index 100% rename from cheatsheets/scp rename to cheatlib/cheatsheets/scp diff --git a/cheatsheets/sed b/cheatlib/cheatsheets/sed similarity index 100% rename from cheatsheets/sed rename to cheatlib/cheatsheets/sed diff --git a/cheatsheets/shred b/cheatlib/cheatsheets/shred similarity index 100% rename from cheatsheets/shred rename to cheatlib/cheatsheets/shred diff --git a/cheatsheets/sockstat b/cheatlib/cheatsheets/sockstat similarity index 100% rename from cheatsheets/sockstat rename to cheatlib/cheatsheets/sockstat diff --git a/cheatsheets/split b/cheatlib/cheatsheets/split similarity index 100% rename from cheatsheets/split rename to cheatlib/cheatsheets/split diff --git a/cheatsheets/ssh b/cheatlib/cheatsheets/ssh similarity index 100% rename from cheatsheets/ssh rename to cheatlib/cheatsheets/ssh diff --git a/cheatsheets/ssh-copy-id b/cheatlib/cheatsheets/ssh-copy-id similarity index 100% rename from cheatsheets/ssh-copy-id rename to cheatlib/cheatsheets/ssh-copy-id diff --git a/cheatsheets/ssh-keygen b/cheatlib/cheatsheets/ssh-keygen similarity index 100% rename from cheatsheets/ssh-keygen rename to cheatlib/cheatsheets/ssh-keygen diff --git a/cheatsheets/stdout b/cheatlib/cheatsheets/stdout similarity index 100% rename from cheatsheets/stdout rename to cheatlib/cheatsheets/stdout diff --git a/cheatsheets/tar b/cheatlib/cheatsheets/tar similarity index 100% rename from cheatsheets/tar rename to cheatlib/cheatsheets/tar diff --git a/setup.py b/setup.py index af240f9..dd459b0 100644 --- a/setup.py +++ b/setup.py @@ -9,8 +9,7 @@ setup(name='cheat', author='Chris Lane', author_email='chris@chris-allen-lane.com', url='https://github.com/chrisallenlane/cheat', - packages=['cheatsheets'], - package_data={'cheatsheets': [f for f in os.listdir('cheatsheets') - if '.' not in f]}, - scripts=['cheat'] + packages=['cheatlib'], + package_data={'cheatlib': ['cheatsheets/*']}, + scripts=['cheat'], )