Skip to content

Commit

Permalink
CLI: Minor additions qmk#12795
Browse files Browse the repository at this point in the history
Make the output a little bit easier to read and provide more context to
the user when the selected keyboard name is already used.
  • Loading branch information
Erovia committed Feb 8, 2022
1 parent 2e279f1 commit 3a19f45
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions lib/python/qmk/cli/new/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,41 @@ def augment_community_info(src, dest):

def prompt_keyboard():
prompt = """{fg_yellow}Name Your Keyboard Project{style_reset_all}
For more infomation, see:
https://docs.qmk.fm/#/hardware_keyboard_guidelines?id=naming-your-keyboardproject
keyboard Name? """
Keyboard Name? """

return question(prompt, validate=lambda x: not keyboard(x).exists())
kb_name = False
while not kb_name:
kb_name = question(prompt)
if keyboard(kb_name).exists():
prompt = f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name:'
kb_name = False
return kb_name


def prompt_user():
prompt = """{fg_yellow}Attribution{style_reset_all}
prompt = """{fg_cyan}=========={fg_reset}
{fg_yellow}Attribution{style_reset_all}
Used for maintainer, copyright, etc
Your GitHub Username? """
return question(prompt, default=git_get_username())


def prompt_name(def_name):
prompt = """{fg_yellow}More Attribution{style_reset_all}
prompt = """{fg_cyan}=========={fg_reset}
{fg_yellow}More Attribution{style_reset_all}
Used for maintainer, copyright, etc
Your Real Name? """
return question(prompt, default=def_name)


def prompt_layout():
prompt = """{fg_yellow}Pick Base Layout{style_reset_all}
prompt = """{fg_cyan}=========={fg_reset}
{fg_yellow}Pick Base Layout{style_reset_all}
As a starting point, one of the common layouts can be used to bootstrap the process
Default Layout? """
Expand All @@ -184,8 +189,8 @@ def prompt_layout():


def prompt_mcu():
prompt = """{fg_yellow}What Powers Your Project{style_reset_all}
prompt = """{fg_cyan}=========={fg_reset}
{fg_yellow}What Powers Your Project{style_reset_all}
For more infomation, see:
https://docs.qmk.fm/#/compatible_microcontrollers
Expand Down

0 comments on commit 3a19f45

Please sign in to comment.