diff options
| author | Joel Challis | 2025-01-29 20:22:05 +0100 |
|---|---|---|
| committer | GitHub | 2025-01-29 20:22:05 +0100 |
| commit | 0c14fc3a211fc6ba55cf58c1b8224700102a33b3 (patch) | |
| tree | 2fb40979f6e5048376e8f9ee1badb2139e5bbfd3 /lib/python/qmk/cli/resolve_alias.py | |
| parent | db68fd88bd67e8b04f5f1ec0c8c54cfe2ce88bb6 (diff) | |
Resolve keyboard_aliases when processing keyboard make targets (#24834)
Diffstat (limited to 'lib/python/qmk/cli/resolve_alias.py')
| -rw-r--r-- | lib/python/qmk/cli/resolve_alias.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/resolve_alias.py b/lib/python/qmk/cli/resolve_alias.py new file mode 100644 index 0000000000..b9ffb46618 --- /dev/null +++ b/lib/python/qmk/cli/resolve_alias.py @@ -0,0 +1,16 @@ +from qmk.keyboard import keyboard_folder + +from milc import cli + + +@cli.argument('--allow-unknown', arg_only=True, action='store_true', help="Return original if rule is not a valid keyboard.") +@cli.argument('keyboard', arg_only=True, help='The keyboard\'s name') +@cli.subcommand('Resolve DEFAULT_FOLDER and any keyboard_aliases for provided rule') +def resolve_alias(cli): + try: + print(keyboard_folder(cli.args.keyboard)) + except ValueError: + if cli.args.allow_unknown: + print(cli.args.keyboard) + else: + raise |