From de2471b93ad798f7a457b6bcae6181921b412727 Mon Sep 17 00:00:00 2001 From: Jeffrey Lund Date: Tue, 20 Aug 2013 15:58:39 -0700 Subject: [PATCH] Simplified cheat_directories, removing bad import --- cheat | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/cheat b/cheat index e49c0ce..b6d122b 100755 --- a/cheat +++ b/cheat @@ -4,19 +4,9 @@ import sys # assembles a list of directories containing cheatsheets def cheat_directories(): - default_directories = [os.path.expanduser('~/.cheat')] - try: - import cheatsheets - default_directories.append(cheatsheets.cheat_dir) - except ImportError: - pass - - default = [ default_dir for default_dir in default_directories if os.path.isdir(default_dir) ] - if 'CHEATPATH' in os.environ and os.environ['CHEATPATH']: - return [ path for path in os.environ['CHEATPATH'].split(os.pathsep)\ - if os.path.isdir(path) ] + default - else: - return default + paths = [os.path.expanduser('~/.cheat')] + paths.extend(os.environ.get('CHEATPATH', '').split(os.pathsep)) + return [path for path in paths if os.path.isdir(path)] # assembles a dictionary of cheatsheets found in the above directories def cheat_files(cheat_directories):