Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qmk new-keymap: validate keymap name #23420

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Allow uppercase for the time being
  • Loading branch information
fauxpark committed Jul 15, 2024
commit b7f59bbe4b089af4413783fc577f78f30127c049
6 changes: 3 additions & 3 deletions lib/python/qmk/cli/new/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@


def validate_keymap_name(name):
"""Returns True if the given keymap name contains only lowercase a-z, 0-9 and underscore characters.
"""Returns True if the given keymap name contains only a-z, 0-9 and underscore characters.
"""
regex = re.compile(r'^[a-z0-9][a-z0-9_]+$')
regex = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_]+$')
return bool(regex.match(name))


Expand Down Expand Up @@ -69,7 +69,7 @@ def new_keymap(cli):
return False

if not validate_keymap_name(user_name):
cli.log.error('Keymap names must contain only {fg_cyan}lowercase a-z{fg_reset}, {fg_cyan}0-9{fg_reset} and {fg_cyan}_{fg_reset}! Please choose a different name.')
cli.log.error('Keymap names must contain only {fg_cyan}a-z{fg_reset}, {fg_cyan}0-9{fg_reset} and {fg_cyan}_{fg_reset}! Please choose a different name.')
return False

if keymap_path_new.exists():
Expand Down
Loading