Configuration system for CLI (#6708)
* Rework how bin/qmk handles subcommands * qmk config wip * Code to show all configs * Fully working `qmk config` command * Mark some CLI arguments so they don't pollute the config file * Fleshed out config support, nicer subcommand support * sync with installable cli * pyformat * Add a test for subcommand_modules * Documentation for the `qmk config` command * split config_token on space so qmk config is more predictable * Rework how subcommands are imported * Document `arg_only` * Document deleting from CLI * Document how multiple operations work * Add cli config to the doc index * Add tests for the cli commands * Make running the tests more reliable * Be more selective about building all default keymaps * Update new-keymap to fit the new subcommand style * Add documentation about writing CLI scripts * Document new-keyboard * Update docs/cli_configuration.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Address yan's comments. * Apply suggestions from code review suggestions from @noahfrederick Co-Authored-By: Noah Frederick <code@noahfrederick.com> * Apply suggestions from code review Co-Authored-By: Noah Frederick <code@noahfrederick.com> * Remove pip3 from the test runner
This commit is contained in:
parent
2f49cae9bc
commit
d569f08771
29 changed files with 715 additions and 199 deletions
|
@ -0,0 +1 @@
|
|||
from . import keymap
|
|
@ -6,15 +6,15 @@ import shutil
|
|||
from milc import cli
|
||||
|
||||
|
||||
@cli.argument('-k', '--keyboard', help='Specify keyboard name. Example: 1upkeyboards/1up60hse')
|
||||
@cli.argument('-u', '--username', help='Specify any name for the new keymap directory')
|
||||
@cli.entrypoint('Creates a new keymap for the keyboard of your choosing')
|
||||
def main(cli):
|
||||
@cli.argument('-kb', '--keyboard', help='Specify keyboard name. Example: 1upkeyboards/1up60hse')
|
||||
@cli.argument('-km', '--keymap', help='Specify the name for the new keymap directory')
|
||||
@cli.subcommand('Creates a new keymap for the keyboard of your choosing')
|
||||
def new_keymap(cli):
|
||||
"""Creates a new keymap for the keyboard of your choosing.
|
||||
"""
|
||||
# ask for user input if keyboard or username was not provided in the command line
|
||||
keyboard = cli.config.general.keyboard if cli.config.general.keyboard else input("Keyboard Name: ")
|
||||
username = cli.config.general.username if cli.config.general.username else input("Username: ")
|
||||
keyboard = cli.config.new_keymap.keyboard if cli.config.new_keymap.keyboard else input("Keyboard Name: ")
|
||||
keymap = cli.config.new_keymap.keymap if cli.config.new_keymap.keymap else input("Keymap Name: ")
|
||||
|
||||
# generate keymap paths
|
||||
kb_path = os.path.join(os.getcwd(), "keyboards", keyboard)
|
||||
|
@ -36,6 +36,5 @@ def main(cli):
|
|||
shutil.copytree(keymap_path_default, keymap_path, symlinks=True)
|
||||
|
||||
# end message to user
|
||||
cli.log.info("%s keymap directory created in: %s\n" +
|
||||
"Compile a firmware file with your new keymap by typing: \n" +
|
||||
"qmk compile -kb %s -km %s", username, keymap_path, keyboard, username)
|
||||
cli.log.info("%s keymap directory created in: %s", username, keymap_path)
|
||||
cli.log.info("Compile a firmware with your new keymap by typing: \n" + "qmk compile -kb %s -km %s", keyboard, username)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue