Changed from 2-spaces per indentation level to 4, per PEP-8 standard.

This commit is contained in:
John Shanahan 2013-08-14 10:36:00 -04:00
parent b6b416e7ce
commit 7cf6291c8a
2 changed files with 14 additions and 14 deletions

18
cheat
View File

@ -8,8 +8,8 @@ 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): 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() exit()
# list the files in the ~/.cheat directory # list the files in the ~/.cheat directory
cheatsheets = os.listdir(cheat_dir) cheatsheets = os.listdir(cheat_dir)
@ -17,16 +17,16 @@ cheatsheets.sort()
# print help if requested # print help if requested
if keyphrase in ['', 'help', '--help', '-h']: if keyphrase in ['', 'help', '--help', '-h']:
print "Usage: cheat [keyphrase]\n" print "Usage: cheat [keyphrase]\n"
print "Available keyphrases:" print "Available keyphrases:"
print "\n".join(cheatsheets) print "\n".join(cheatsheets)
exit() exit()
# print the cheatsheet if it exists # print the cheatsheet if it exists
if keyphrase in cheatsheets: if keyphrase in cheatsheets:
with open (cheat_dir + keyphrase, 'r') as cheatsheet: with open (cheat_dir + keyphrase, 'r') as cheatsheet:
print cheatsheet.read() print cheatsheet.read()
# if it does not, say so # if it does not, say so
else: else:
print 'No cheatsheet found.' print 'No cheatsheet found.'

10
install
View File

@ -4,9 +4,9 @@ import shutil
import sys import sys
try: try:
shutil.copy('./cheat', '/usr/local/bin/') shutil.copy('./cheat', '/usr/local/bin/')
shutil.copytree('./.cheat', expanduser('~') + '/.cheat') shutil.copytree('./.cheat', expanduser('~') + '/.cheat')
print "cheat has been installed successfully." print "cheat has been installed successfully."
except IOError as e: except IOError as e:
print >> sys.stderr, "This installer must be run as root." print >> sys.stderr, "This installer must be run as root."
sys.exit(1) sys.exit(1)