Skip to content

Commit

Permalink
Merge pull request #109 from ErnestChen1/master
Browse files Browse the repository at this point in the history
[add] a regular format check
  • Loading branch information
armink committed Nov 13, 2019
2 parents 46cabcc + de9ef9d commit 593e844
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmds/cmd_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import logging
import archive
import sys
import re

try:
import requests
Expand Down Expand Up @@ -891,9 +892,14 @@ def package_wizard():
#first step
print ('\033[5;33;40m\n1.Please input a new package name :\033[0m')
name = raw_input()
while name == '' or name.isspace() == True :
print ('\033[1;31;40mError: you must input a package name. Try again.\033[0m')
name = raw_input()
regular_obj = re.compile('\W')
while name == '' or name.isspace() == True or regular_obj.search(name.strip()):
if name == '' or name.isspace():
print ('\033[1;31;40mError: you must input a package name. Try again.\033[0m')
name = raw_input()
else:
print ('\033[1;31;40mError: package name is made of alphabet, number and underline. Try again.\033[0m')
name = raw_input()

default_description = 'Please add description of ' + name + ' in English.'
#description = user_input('menuconfig option name,default:\n',default_description)
Expand Down

0 comments on commit 593e844

Please sign in to comment.