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

10
install
View File

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