Skip to content

Commit

Permalink
Instead of bailing on bad name input, re-prompt for new name
Browse files Browse the repository at this point in the history
  • Loading branch information
evansolomon committed Aug 19, 2012
1 parent cc3dcfd commit 251f23b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions _sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import urllib
import urllib2
import shutil
import sys
import zipfile
import os

Expand All @@ -17,14 +16,14 @@ print "Let's get started.\n"
name = raw_input('Name? ')

# You need to provide at least a name
if not name:
print "\nYou need a name for your theme.\n\nExiting..."
sys.exit()
while not name:
print "\nYou need a name for your theme.\n\n"
name = raw_input('Name? ')

# ... and it needs to be unique
if os.path.exists(name) or os.path.exists(name + '.zip'):
print "\nYou should pick a name that isn't already used for a file or directory.\n\nExiting..."
sys.exit()
while os.path.exists(name) or os.path.exists(name + '.zip'):
print "\nYou should pick a name that isn't already used for a file or directory.\n\n"
name = raw_input('Name? ')

# Get the rest of your customizations
slug = raw_input('Slug? ')
Expand Down

0 comments on commit 251f23b

Please sign in to comment.