mirror of https://github.com/cheat/cheat.git
Simplified cheat_directories, removing bad import
This commit is contained in:
parent
1e26280da7
commit
de2471b93a
16
cheat
16
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):
|
||||
|
|
Loading…
Reference in New Issue