mirror of
https://github.com/cheat/cheat.git
synced 2025-09-01 17:48:30 +02:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
e4417b2d65 | |||
eda53cccd6 | |||
ccfe2a9cbd | |||
301203f268 | |||
9cd4bdd6d7 | |||
7b895adee5 | |||
b77b9e8541 | |||
d68fb456ba | |||
d7d033c908 | |||
fa4b482832 | |||
cf8893ec5f | |||
0a3fd3559c | |||
6a4414f538 | |||
538aeee2b2 | |||
371c0af156 | |||
8677e0c35a | |||
afcaaafbe5 | |||
f128167311 | |||
74a91aa1d4 | |||
377da479e6 |
9
CONTRIBUTING.md
Normal file
9
CONTRIBUTING.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Contributing
|
||||||
|
============
|
||||||
|
If you would like to contribute cheetsheets or program functionality, please
|
||||||
|
fork this repository, make your changes, and send me a pull request.
|
||||||
|
|
||||||
|
Python code show follow the standards laid out by [PEP 8][].
|
||||||
|
|
||||||
|
|
||||||
|
[PEP 8]: http://legacy.python.org/dev/peps/pep-0008/
|
19
README.md
19
README.md
@ -9,6 +9,10 @@ remember.
|
|||||||
|
|
||||||
`cheat` depends only on `python` and `pip`.
|
`cheat` depends only on `python` and `pip`.
|
||||||
|
|
||||||
|
PyPI status:
|
||||||
|
|
||||||
|
[](https://pypi.python.org/pypi/cheat/)
|
||||||
|
[](https://pypi.python.org/pypi/cheat/)
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
@ -45,6 +49,14 @@ to store notes on your favorite cookie recipes, feel free.
|
|||||||
|
|
||||||
Installing
|
Installing
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
### Using pip ###
|
||||||
|
|
||||||
|
sudo pip install cheat
|
||||||
|
|
||||||
|
|
||||||
|
### Manually ###
|
||||||
|
|
||||||
First install the required python dependencies with:
|
First install the required python dependencies with:
|
||||||
|
|
||||||
sudo pip install docopt pygments
|
sudo pip install docopt pygments
|
||||||
@ -104,6 +116,13 @@ enable this feature, set a `CHEATCOLORS` environment variable:
|
|||||||
|
|
||||||
export CHEATCOLORS=true
|
export CHEATCOLORS=true
|
||||||
|
|
||||||
|
### Enabling Command-line Autocompletion ###
|
||||||
|
The `cheat/autocompletion` directory contains scripts to enable command-line
|
||||||
|
autocompletion for various shells. To activate autocompletion, simply copy the
|
||||||
|
appropriate script to the appropriate path on your system. (The "appropriate
|
||||||
|
path" will vary on a per-platform basis, so this documentation shall not
|
||||||
|
speculate as to where that may be.)
|
||||||
|
|
||||||
|
|
||||||
Related Projects
|
Related Projects
|
||||||
----------------
|
----------------
|
||||||
|
@ -38,7 +38,7 @@ from docopt import docopt
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# parse the command-line options
|
# parse the command-line options
|
||||||
options = docopt(__doc__, version='cheat 2.0.2')
|
options = docopt(__doc__, version='cheat 2.0.9')
|
||||||
|
|
||||||
# list directories
|
# list directories
|
||||||
if options['--directories']:
|
if options['--directories']:
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import sheet
|
from . import sheet
|
||||||
import sheets
|
from . import sheets
|
||||||
import utils
|
from . import utils
|
||||||
|
@ -2,6 +2,12 @@ from cheat import cheatsheets
|
|||||||
from cheat.utils import *
|
from cheat.utils import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# @kludge: it breaks the functional paradigm to a degree, but declaring this
|
||||||
|
# var here (versus within get()) gives us a "poor man's" memoization on the
|
||||||
|
# call to get(). This, in turn, spares us from having to call out to the
|
||||||
|
# filesystem more than once.
|
||||||
|
cheats = {}
|
||||||
|
|
||||||
|
|
||||||
def default_path():
|
def default_path():
|
||||||
""" Returns the default cheatsheet path """
|
""" Returns the default cheatsheet path """
|
||||||
@ -35,10 +41,15 @@ def default_path():
|
|||||||
return default_sheets_dir
|
return default_sheets_dir
|
||||||
|
|
||||||
|
|
||||||
# @todo: memoize result
|
|
||||||
def get():
|
def get():
|
||||||
""" Assembles a dictionary of cheatsheets as name => file-path """
|
""" Assembles a dictionary of cheatsheets as name => file-path """
|
||||||
cheats = {}
|
|
||||||
|
# if we've already reached out to the filesystem, just return the result
|
||||||
|
# from memory
|
||||||
|
if cheats:
|
||||||
|
return cheats
|
||||||
|
|
||||||
|
# otherwise, scan the filesystem
|
||||||
for cheat_dir in reversed(paths()):
|
for cheat_dir in reversed(paths()):
|
||||||
cheats.update(
|
cheats.update(
|
||||||
dict([
|
dict([
|
||||||
|
7
setup.py
7
setup.py
@ -3,7 +3,7 @@ import os
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'cheat',
|
name = 'cheat',
|
||||||
version = '2.0.2',
|
version = '2.0.9',
|
||||||
author = 'Chris Lane',
|
author = 'Chris Lane',
|
||||||
author_email = 'chris@chris-allen-lane.com',
|
author_email = 'chris@chris-allen-lane.com',
|
||||||
license = 'GPL3',
|
license = 'GPL3',
|
||||||
@ -21,11 +21,6 @@ setup(
|
|||||||
'cheat.cheatsheets': [f for f in os.listdir('cheat/cheatsheets') if '.' not in f]
|
'cheat.cheatsheets': [f for f in os.listdir('cheat/cheatsheets') if '.' not in f]
|
||||||
},
|
},
|
||||||
scripts = ['bin/cheat'],
|
scripts = ['bin/cheat'],
|
||||||
data_files = [
|
|
||||||
('/usr/share/zsh/site-functions', ['cheat/autocompletion/_cheat.zsh']),
|
|
||||||
('/etc/bash_completion.d' , ['cheat/autocompletion/cheat.bash']),
|
|
||||||
('/usr/share/fish/completions' , ['cheat/autocompletion/cheat.fish'])
|
|
||||||
],
|
|
||||||
install_requires = [
|
install_requires = [
|
||||||
'docopt >= 0.6.1',
|
'docopt >= 0.6.1',
|
||||||
'pygments >= 1.6.0',
|
'pygments >= 1.6.0',
|
||||||
|
Reference in New Issue
Block a user