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.
cli.echo('For more info, visit https://docs.qmk.fm/#/flashing')
@cli.argument('-bl','--bootloader',default='flash',help='The flash command, corresponding to qmk\'s make options of bootloaders.')
@cli.argument('filename',nargs='?',arg_only=True,type=FileType('r'),help='The configurator export JSON to compile.')
@cli.argument('-b','--bootloaders',action='store_true',help='List the available bootloaders.')
@cli.argument('-bl','--bootloader',default='flash',help='The flash command, corresponding to qmk\'s make options of bootloaders.')
@cli.argument('-km','--keymap',help='The keymap to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
@cli.argument('-kb','--keyboard',help='The keyboard to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
@cli.argument('-b','--bootloaders',action='store_true',help='List the available bootloaders.')
@cli.argument('-n','--dry-run',arg_only=True,action='store_true',help="Don't actually build, just show the make command to be run.")
@cli.subcommand('QMK Flash.')
@automagic_keyboard
@automagic_keymap
defflash(cli):
"""Compile and or flash QMK Firmware or keyboard/layout