Compare commits

...

20 Commits
2.0.2 ... 2.0.9

Author SHA1 Message Date
e4417b2d65 Version bump
Realized a 2.0.8 had already been pushed to PyPi, so I just
version-bumped this to 2.0.9.
2014-06-03 22:38:24 -04:00
eda53cccd6 Minor tweaks on PR #163
- Backed out Windows-related work in `setup.py`, because it is still
  in-progress

- Minor changes to the `README`
2014-06-03 22:34:50 -04:00
ccfe2a9cbd missing file in version bump 2014-05-30 12:24:39 +10:00
301203f268 version bump as requested 2014-05-30 12:20:09 +10:00
9cd4bdd6d7 Merge branch 'master' of github.com:chid/cheat 2014-05-30 12:18:43 +10:00
7b895adee5 Merge branch 'master' of https://github.com/chrisallenlane/cheat
Conflicts:
	setup.py
2014-05-30 12:14:33 +10:00
b77b9e8541 Update README.md 2014-05-29 12:01:25 +10:00
d68fb456ba Added PyPi Badge
Added Badge
2014-05-29 11:59:40 +10:00
d7d033c908 Version bump 2014-05-28 21:02:27 -04:00
fa4b482832 Merge branch 'py3-fix' of github.com:chid/cheat into chid-py3-fix
* 'py3-fix' of github.com:chid/cheat:
  simple py3 import change
2014-05-28 21:00:52 -04:00
cf8893ec5f Merge pull request #165 from chrisallenlane/no-autocomplete
Resolves #160
2014-05-28 20:51:11 -04:00
0a3fd3559c Resolves #160
The `setup.py` script no longer attempts to install files to privileged
system directories. (Previously, it attempted to do this in order to
enable command-line autocompletion.) In lieu of doing this within the
installer directly, I have simply included brief instructions explaining
how to configure this manually.

Version bumped accordingly.
2014-05-28 20:49:56 -04:00
6a4414f538 simple py3 import change 2014-05-29 09:56:54 +10:00
538aeee2b2 adding creation of batch file 2014-05-29 09:40:58 +10:00
371c0af156 Trivial
Deleted an unneeded space character.
2014-05-25 23:05:26 -04:00
8677e0c35a Added a CONTRIBUTING.md file
- Added a CONTRIBUTING.md file
- Corrected a small indentation error
- version bump
2014-05-25 22:19:43 -04:00
afcaaafbe5 Improved filesystem efficiency
Previously, `sheets.print()` would query the filesystem every time it
was invoked. This was inelegant, because it is called multiple times
every time `cheat` is executed. Thus, unnecessary calls were being made
out to the filesystem.

Now the result of that function is being buffered into a module variable
when it is executed the first time, and served from there thereafter. I
broke the "functional" paradigm to a degree by doing this, but it wasn't
worth the complexity of implementing proper memoization (decorators,
etc) for such a trivial case.

Bumped the version number accordingly.
2014-05-25 21:55:25 -04:00
f128167311 Version bump 2014-05-25 19:47:08 -04:00
74a91aa1d4 Merge branch 'windows_setup' of github.com:chid/cheat into chid-windows_setup
* 'windows_setup' of github.com:chid/cheat:
  fix setup for Windows
2014-05-25 19:45:24 -04:00
377da479e6 fix setup for Windows 2014-05-24 16:29:40 +10:00
8 changed files with 48 additions and 14 deletions

9
CONTRIBUTING.md Normal file
View 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/

View File

@ -9,6 +9,10 @@ remember.
`cheat` depends only on `python` and `pip`.
PyPI status:
[![Latest Version](https://pypip.in/version/cheat/badge.png)](https://pypi.python.org/pypi/cheat/)
[![Downloads](https://pypip.in/download/cheat/badge.png)](https://pypi.python.org/pypi/cheat/)
Example
-------
@ -45,6 +49,14 @@ to store notes on your favorite cookie recipes, feel free.
Installing
----------
### Using pip ###
sudo pip install cheat
### Manually ###
First install the required python dependencies with:
sudo pip install docopt pygments
@ -104,6 +116,13 @@ enable this feature, set a `CHEATCOLORS` environment variable:
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
----------------

View File

@ -38,7 +38,7 @@ from docopt import docopt
if __name__ == '__main__':
# parse the command-line options
options = docopt(__doc__, version='cheat 2.0.2')
options = docopt(__doc__, version='cheat 2.0.9')
# list directories
if options['--directories']:

View File

@ -1,3 +1,3 @@
import sheet
import sheets
import utils
from . import sheet
from . import sheets
from . import utils

View File

@ -2,6 +2,12 @@ from cheat import cheatsheets
from cheat.utils import *
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():
""" Returns the default cheatsheet path """
@ -35,10 +41,15 @@ def default_path():
return default_sheets_dir
# @todo: memoize result
def get():
""" 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()):
cheats.update(
dict([

View File

@ -23,7 +23,7 @@ def colorize(sheet_content):
def die(message):
""" Prints a message to stderr and then terminates """
warn (message)
warn(message)
exit(1)

View File

@ -3,7 +3,7 @@ import os
setup(
name = 'cheat',
version = '2.0.2',
version = '2.0.9',
author = 'Chris Lane',
author_email = 'chris@chris-allen-lane.com',
license = 'GPL3',
@ -20,12 +20,7 @@ setup(
package_data = {
'cheat.cheatsheets': [f for f in os.listdir('cheat/cheatsheets') if '.' not in f]
},
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'])
],
scripts = ['bin/cheat'],
install_requires = [
'docopt >= 0.6.1',
'pygments >= 1.6.0',