From e662862b7bc8d1f7574ad9011ff2404863d53b76 Mon Sep 17 00:00:00 2001 From: a-sk Date: Thu, 29 Aug 2013 18:20:23 +0400 Subject: [PATCH] Introduce DEFAULT_CHEAT_DIR environment variable Now ~/.cheat can be overridden --- cheat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cheat b/cheat index 2abc94a..ce8592c 100755 --- a/cheat +++ b/cheat @@ -3,7 +3,8 @@ import os import sys import subprocess -DEFAULT_CHEAT_DIR = os.path.join(os.path.expanduser('~'), '.cheat') +DEFAULT_CHEAT_DIR = os.environ.get('DEFAULT_CHEAT_DIR') or \ + os.path.join(os.path.expanduser('~'), '.cheat') USE_PYGMENTS = False # NOTE remove this check if it is confirmed to work on windows @@ -140,6 +141,7 @@ def main(): elif option in ['-c', '--create']: create_cheatsheet(' '.join(sys.argv[2:]), cheatsheets) + # print the cheatsheet if it exists if keyphrase in cheatsheets: filename = os.path.join(cheatsheets[keyphrase], keyphrase)