summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjack <0x6A73@pm.me>2022-12-23 11:18:57 -0700
committerGitHub <noreply@github.com>2022-12-23 18:18:57 +0000
commit003cee00980172c1305bf97b3c5a5801de336866 (patch)
tree22c384bf95bf0930feb177ec2b7d41f8a5016f71
parent1c5a67b76709f38a6424468de19d1e15d3347165 (diff)
Validate keyboard name before accepting further input (#19394)
-rw-r--r--lib/python/qmk/cli/new/keyboard.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/python/qmk/cli/new/keyboard.py b/lib/python/qmk/cli/new/keyboard.py
index 251ad919dd..cdd3919168 100644
--- a/lib/python/qmk/cli/new/keyboard.py
+++ b/lib/python/qmk/cli/new/keyboard.py
@@ -195,11 +195,6 @@ def new_keyboard(cli):
cli.echo('')
kb_name = cli.args.keyboard if cli.args.keyboard else prompt_keyboard()
- user_name = cli.config.new_keyboard.name if cli.config.new_keyboard.name else prompt_user()
- real_name = cli.args.realname or cli.config.new_keyboard.name if cli.args.realname or cli.config.new_keyboard.name else prompt_name(user_name)
- default_layout = cli.args.layout if cli.args.layout else prompt_layout()
- mcu = cli.args.type if cli.args.type else prompt_mcu()
-
if not validate_keyboard_name(kb_name):
cli.log.error('Keyboard 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.')
return 1
@@ -208,6 +203,11 @@ def new_keyboard(cli):
cli.log.error(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.')
return 1
+ user_name = cli.config.new_keyboard.name if cli.config.new_keyboard.name else prompt_user()
+ real_name = cli.args.realname or cli.config.new_keyboard.name if cli.args.realname or cli.config.new_keyboard.name else prompt_name(user_name)
+ default_layout = cli.args.layout if cli.args.layout else prompt_layout()
+ mcu = cli.args.type if cli.args.type else prompt_mcu()
+
# Preprocess any development_board presets
if mcu in dev_boards:
defaults_map = json_load(Path('data/mappings/defaults.hjson'))