Skip to content

Commit

Permalink
[wizard] 允许使用-命名软件包
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterywolf committed Sep 3, 2022
1 parent 99f69f2 commit 63a874d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmds/cmd_package/cmd_package_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def package_wizard():
print('\033[5;33;40m\n1.Please input a new package name :\033[0m')

name = user_input()
regular_obj = re.compile('\W')
while name == '' or name.isspace() == True or regular_obj.search(name.strip()):
regular_obj = re.compile('^[\w\d_-]*$')
while name == '' or name.isspace() == True or regular_obj.search(name.strip()) == False:
if name == '' or name.isspace():
print('\033[1;31;40mError: you must input a package name. Try again.\033[0m')
name = user_input()
Expand Down Expand Up @@ -155,6 +155,7 @@ def package_wizard():

s = Template(Kconfig_file)
upper_name = str.upper(name)
upper_name = upper_name.replace('-', '_')
kconfig = s.substitute(name=upper_name, description=description, version=ver,
pkgs_class=package_class, lowercase_name=name, version_standard=ver_standard)
f = open(os.path.join(pkg_path, 'Kconfig'), 'w')
Expand Down

0 comments on commit 63a874d

Please sign in to comment.