Package with distutils

Created cheatsheets package to store the default sheets.
This commit is contained in:
Louis Taylor committed 2013-08-13 11:01:06 +01:00
1 parent 098384d341
commit 8dda6a9241
23 files changed
+26 -6

No files matched your search

+7 -6
View File
@@ -1,18 +1,18 @@
#!/usr/bin/env python
import os
import sys
from cheatsheets import cheat_dir
# assemble a keyphrase out of all params passed to the script
keyphrase = ' '.join(sys.argv[1:])
cheat_dir = os.path.expanduser('~') + '/.cheat/'
# verify that the ~/.cheat directory exists
# verify that the cheat directory exists
if not os.path.isdir(cheat_dir):
print >> sys.stderr, 'The ~/.cheat directory does not exist.'
print >> sys.stderr, 'The cheat directory does not exist.'
exit()
# list the files in the ~/.cheat directory
cheatsheets = os.listdir(cheat_dir)
# list the files in the cheat directory
cheatsheets = [f for f in os.listdir(cheat_dir) if '.' not in f]
cheatsheets.sort()
# print help if requested
@@ -24,7 +24,8 @@ if keyphrase in ['', 'help', '--help', '-h']:
# print the cheatsheet if it exists
if keyphrase in cheatsheets:
with open (cheat_dir + keyphrase, 'r') as cheatsheet:
cheatsheet_filename = os.path.join(cheat_dir, keyphrase)
with open(cheatsheet_filename, 'r') as cheatsheet:
print cheatsheet.read()
# if it does not, say so
+3
View File
@@ -0,0 +1,3 @@
import os
cheat_dir, __init = os.path.split(__file__)
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env python
from distutils.core import setup
import os
setup(name='cheat',
version='1.0',
description='Create and view interactive cheatsheets on the command-line',
author='Chris Lane',
author_email='chris@chris-allen-lane.com',
url='https://github.com/chrisallenlane/cheat',
packages=['cheatsheets'],
package_data={'cheatsheets': [f for f in os.listdir('cheatsheets')
if '.' not in f]},
scripts=['cheat']
)