Merge branch 'DEFAULT_CHEAT_DIR' of https://github.com/a-sk/cheat into a-sk-DEFAULT_CHEAT_DIR

* 'DEFAULT_CHEAT_DIR' of https://github.com/a-sk/cheat:
  Add note about DEFAULT_CHEAT_DIR to the README file
  Remove odd new line
  Introduce DEFAULT_CHEAT_DIR environment variable
This commit is contained in:
Chris Lane 2013-09-01 13:47:42 -04:00
commit e71a3d627d
2 changed files with 10 additions and 1 deletions

View File

@ -88,6 +88,14 @@ Advanced Features
Setting a CHEATPATH Setting a CHEATPATH
---------------------- ----------------------
By default cheatsheets are stored in the `~/.cheat/` directory, you can
override it by setting `DEFAULT_CHEAT_DIR` environment variable.
```bash
export DEFAULT_CHEAT_DIR=/path/to/my/cheats
```
By default, all cheatsheets are installed to `~/.cheat/`, but you can instruct By default, all cheatsheets are installed to `~/.cheat/`, but you can instruct
`cheat` to look for cheatsheets in other directories by exporting a `CHEATPATH` `cheat` to look for cheatsheets in other directories by exporting a `CHEATPATH`
environment variable: environment variable:

3
cheat
View File

@ -3,7 +3,8 @@ import os
import sys import sys
import subprocess 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 USE_PYGMENTS = False
# NOTE remove this check if it is confirmed to work on windows # NOTE remove this check if it is confirmed to work on windows