Minor modifications on the cheat file. Broke the -d option out into its own logical block.

This commit is contained in:
Chris Lane 2013-09-01 14:41:29 -04:00
parent 91d01d9b96
commit 14821d424c
1 changed files with 6 additions and 5 deletions

11
cheat
View File

@ -122,11 +122,7 @@ def main():
# create/edit option # create/edit option
option = sys.argv[1].lower() option = sys.argv[1].lower()
if option in ['-e', '--edit', '-c', '--create', '-d', '--cheat_directories']: if option in ['-e', '--edit', '-c', '--create']:
# list cheat directories and exit
if option in ['-d', '--cheat_directories']:
print(' '.join(cheat_directories()))
exit()
# make sure EDITOR environment variable is set and that at least 3 arguments # make sure EDITOR environment variable is set and that at least 3 arguments
# are given # are given
if 'EDITOR' not in os.environ: if 'EDITOR' not in os.environ:
@ -145,6 +141,11 @@ def main():
elif option in ['-c', '--create']: elif option in ['-c', '--create']:
create_cheatsheet(' '.join(sys.argv[2:]), cheatsheets) create_cheatsheet(' '.join(sys.argv[2:]), cheatsheets)
# list cheat directories and exit
if option in ['-d', '--cheat_directories']:
print(' '.join(cheat_directories()))
exit()
# print the cheatsheet if it exists # print the cheatsheet if it exists
if keyphrase in cheatsheets: if keyphrase in cheatsheets:
filename = os.path.join(cheatsheets[keyphrase], keyphrase) filename = os.path.join(cheatsheets[keyphrase], keyphrase)