From 6eb6e4669ab88bed501e92da699056ef5f8c766d Mon Sep 17 00:00:00 2001 From: skullydazed Date: Fri, 13 Mar 2020 15:47:04 -0700 Subject: Add decorators for determining keyboard and keymap based on current directory (#8191) * Use pathlib everywhere we can * Improvements based on @erovia's feedback * rework qmk compile and qmk flash to use pathlib * style * Remove the subcommand_name argument from find_keyboard_keymap() * add experimental decorators * Create decorators for finding keyboard and keymap based on current directory. Decorators were inspired by @Erovia's brilliant work on the proof of concept. --- lib/python/qmk/cli/new/keymap.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/python/qmk/cli/new/keymap.py') diff --git a/lib/python/qmk/cli/new/keymap.py b/lib/python/qmk/cli/new/keymap.py index cbe50692ec..5ae2628565 100755 --- a/lib/python/qmk/cli/new/keymap.py +++ b/lib/python/qmk/cli/new/keymap.py @@ -4,12 +4,15 @@ import shutil from pathlib import Path import qmk.path +from qmk.decorators import automagic_keyboard, automagic_keymap from milc import 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') +@automagic_keyboard +@automagic_keymap def new_keymap(cli): """Creates a new keymap for the keyboard of your choosing. """ -- cgit v1.2.3