Added main function and wrapped everything in it.

This commit is contained in:
John Shanahan 2013-08-19 15:23:53 -04:00
parent 84f3105139
commit 01b35ab0b7
1 changed files with 32 additions and 26 deletions

6
cheat
View File

@ -19,6 +19,9 @@ def cheat_files(cheat_directories):
for cheat in os.listdir(cheat_dir) if '.' not in cheat ])) for cheat in os.listdir(cheat_dir) if '.' not in cheat ]))
return cheats return cheats
def main():
"""MAIN"""
# assemble a keyphrase out of all params passed to the script # assemble a keyphrase out of all params passed to the script
keyphrase = ' '.join(sys.argv[1:]) keyphrase = ' '.join(sys.argv[1:])
cheat_dirs = cheat_directories() cheat_dirs = cheat_directories()
@ -50,3 +53,6 @@ if keyphrase in cheatsheets:
# if it does not, say so # if it does not, say so
else: else:
print 'No cheatsheet found for %s.' % keyphrase print 'No cheatsheet found for %s.' % keyphrase
if __name__ == '__main__':
main()