Add autocomplete to generate-compilation-database (#20387)

This commit is contained in:
Dasky 2023-04-09 17:41:30 +01:00 committed by GitHub
parent 2c375e6478
commit 6e0acf0548
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,8 @@ from milc import cli, MILC
from qmk.commands import create_make_command from qmk.commands import create_make_command
from qmk.constants import QMK_FIRMWARE from qmk.constants import QMK_FIRMWARE
from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.decorators import automagic_keyboard, automagic_keymap
from qmk.keyboard import keyboard_completer, keyboard_folder
from qmk.keymap import keymap_completer
@lru_cache(maxsize=10) @lru_cache(maxsize=10)
@ -74,8 +76,8 @@ def parse_make_n(f: Iterator[str]) -> List[Dict[str, str]]:
return records return records
@cli.argument('-kb', '--keyboard', help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.') @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='The keyboard\'s name')
@cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Ignored when a configurator export is supplied.') @cli.argument('-km', '--keymap', completer=keymap_completer, help='The keymap\'s name')
@cli.subcommand('Create a compilation database.') @cli.subcommand('Create a compilation database.')
@automagic_keyboard @automagic_keyboard
@automagic_keymap @automagic_keymap
@ -104,7 +106,7 @@ def generate_compilation_database(cli: MILC) -> Union[bool, int]:
if not command: if not command:
cli.log.error('You must supply both `--keyboard` and `--keymap`, or be in a directory for a keyboard or keymap.') cli.log.error('You must supply both `--keyboard` and `--keymap`, or be in a directory for a keyboard or keymap.')
cli.echo('usage: qmk compiledb [-kb KEYBOARD] [-km KEYMAP]') cli.echo('usage: qmk generate-compilation-database [-kb KEYBOARD] [-km KEYMAP]')
return False return False
# remove any environment variable overrides which could trip us up # remove any environment variable overrides which could trip us up