give user the option to edit cheatsheet when trying to create an existing cheatsheet

This commit is contained in:
Ritchie Lincoln 2013-09-07 12:41:51 -06:00
parent bbabedb3ce
commit ffcafa4480
1 changed files with 6 additions and 2 deletions

8
cheat
View File

@ -64,8 +64,12 @@ def edit_cheatsheet(cheat, cheatsheets):
def create_cheatsheet(cheat, cheatsheets): def create_cheatsheet(cheat, cheatsheets):
"Create a new cheatsheet." "Create a new cheatsheet."
if cheat in cheatsheets: if cheat in cheatsheets:
print ('Cheatsheet "%s" already exists' % cheat) print ('Cheatsheet "%s" already exists...' % cheat)
exit() ans = raw_input('Would you like to edit cheatsheet for "%s" (Y/N)? ' % cheat)
if ans.lower() in ['y', 'yes']:
edit_cheatsheet(cheat, cheatsheets)
else:
exit()
import cheatsheets as cs import cheatsheets as cs