Merge pull request #435 from roachsinai/master

Expand ~ for 'CHEAT_USER_DIR', 'CHEAT_DEFAULT_DIR' and 'DEFAULT_CHEAT…
This commit is contained in:
Chris Allen Lane 2019-02-13 12:40:25 -05:00 committed by GitHub
commit ec360ccddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -49,15 +49,14 @@ class Configuration:
]).strip().lower()
# self.cheat_user_dir
self.cheat_user_dir = self._select([
os.environ.get('CHEAT_USER_DIR'),
os.environ.get('CHEAT_DEFAULT_DIR'),
os.environ.get('DEFAULT_CHEAT_DIR'),
# TODO: XDG home?
os.path.expanduser(
os.path.expandvars(os.path.join('~', '.cheat'))
),
])
self.cheat_user_dir = self._select(
map(os.path.expanduser,
filter(None,
[os.environ.get('CHEAT_USER_DIR'),
os.environ.get('CHEAT_DEFAULT_DIR'),
os.environ.get('DEFAULT_CHEAT_DIR'),
# TODO: XDG home?
os.path.join('~', '.cheat')])))
# self.cheat_editor
self.cheat_editor = self._select([