mirror of https://github.com/cheat/cheat.git
No breakage when cheatsheets package isn't found
This means cheat can be installed in only the home directory again.
This commit is contained in:
parent
6627b06b1d
commit
570d05349e
10
cheat
10
cheat
|
@ -1,10 +1,16 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import cheatsheets
|
|
||||||
|
|
||||||
def cheat_directories():
|
def cheat_directories():
|
||||||
default = [ default_dir for default_dir in [os.path.expanduser('~/.cheat'), cheatsheets.cheat_dir] if os.path.isdir(default_dir) ]
|
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']:
|
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
|
return [ path for path in os.environ['CHEATPATH'].split(os.pathsep) if os.path.isdir(path) ] + default
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue