diff options
author | Zach White <skullydazed@gmail.com> | 2021-04-14 19:00:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 19:00:22 -0700 |
commit | 588bcdc8ca212b195a428fc43766a59a9252c08d (patch) | |
tree | 4867ef610b2178d51002063bd4913e806f771543 /lib/python/qmk/cli/generate | |
parent | b33e6793de6c5f5124ee88fb3eb62d8f54f74940 (diff) | |
download | qmk_firmware-588bcdc8ca212b195a428fc43766a59a9252c08d.tar.gz qmk_firmware-588bcdc8ca212b195a428fc43766a59a9252c08d.zip |
Add support for tab completion (#12411)
* Add support for tab completion
* make flake8 happy
* Add documentation
Diffstat (limited to 'lib/python/qmk/cli/generate')
-rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 4 | ||||
-rw-r--r-- | lib/python/qmk/cli/generate/dfu_header.py | 3 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/info_json.py | 4 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/layouts.py | 4 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/rules_mk.py | 4 |
5 files changed, 10 insertions, 9 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index ccea6d7a0..54cd5b96a 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py | |||
@@ -8,7 +8,7 @@ from milc import cli | |||
8 | from qmk.decorators import automagic_keyboard, automagic_keymap | 8 | from qmk.decorators import automagic_keyboard, automagic_keymap |
9 | from qmk.info import info_json | 9 | from qmk.info import info_json |
10 | from qmk.json_schema import json_load | 10 | from qmk.json_schema import json_load |
11 | from qmk.keyboard import keyboard_folder | 11 | from qmk.keyboard import keyboard_completer, keyboard_folder |
12 | from qmk.path import is_keyboard, normpath | 12 | from qmk.path import is_keyboard, normpath |
13 | 13 | ||
14 | 14 | ||
@@ -75,7 +75,7 @@ def matrix_pins(matrix_pins): | |||
75 | 75 | ||
76 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') | 76 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') |
77 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") | 77 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") |
78 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to generate config.h for.') | 78 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate config.h for.') |
79 | @cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) | 79 | @cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) |
80 | @automagic_keyboard | 80 | @automagic_keyboard |
81 | @automagic_keymap | 81 | @automagic_keymap |
diff --git a/lib/python/qmk/cli/generate/dfu_header.py b/lib/python/qmk/cli/generate/dfu_header.py index 6f958b3a3..211ed9991 100644 --- a/lib/python/qmk/cli/generate/dfu_header.py +++ b/lib/python/qmk/cli/generate/dfu_header.py | |||
@@ -6,11 +6,12 @@ from milc import cli | |||
6 | from qmk.decorators import automagic_keyboard | 6 | from qmk.decorators import automagic_keyboard |
7 | from qmk.info import info_json | 7 | from qmk.info import info_json |
8 | from qmk.path import is_keyboard, normpath | 8 | from qmk.path import is_keyboard, normpath |
9 | from qmk.keyboard import keyboard_completer | ||
9 | 10 | ||
10 | 11 | ||
11 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') | 12 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') |
12 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") | 13 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") |
13 | @cli.argument('-kb', '--keyboard', help='Keyboard to generate LUFA Keyboard.h for.') | 14 | @cli.argument('-kb', '--keyboard', completer=keyboard_completer, help='Keyboard to generate LUFA Keyboard.h for.') |
14 | @cli.subcommand('Used by the make system to generate LUFA Keyboard.h from info.json', hidden=True) | 15 | @cli.subcommand('Used by the make system to generate LUFA Keyboard.h from info.json', hidden=True) |
15 | @automagic_keyboard | 16 | @automagic_keyboard |
16 | def generate_dfu_header(cli): | 17 | def generate_dfu_header(cli): |
diff --git a/lib/python/qmk/cli/generate/info_json.py b/lib/python/qmk/cli/generate/info_json.py index 1af7f0439..8931b68b6 100755 --- a/lib/python/qmk/cli/generate/info_json.py +++ b/lib/python/qmk/cli/generate/info_json.py | |||
@@ -11,7 +11,7 @@ from qmk.decorators import automagic_keyboard, automagic_keymap | |||
11 | from qmk.info import info_json | 11 | from qmk.info import info_json |
12 | from qmk.json_encoders import InfoJSONEncoder | 12 | from qmk.json_encoders import InfoJSONEncoder |
13 | from qmk.json_schema import load_jsonschema | 13 | from qmk.json_schema import load_jsonschema |
14 | from qmk.keyboard import keyboard_folder | 14 | from qmk.keyboard import keyboard_completer, keyboard_folder |
15 | from qmk.path import is_keyboard | 15 | from qmk.path import is_keyboard |
16 | 16 | ||
17 | 17 | ||
@@ -41,7 +41,7 @@ def strip_info_json(kb_info_json): | |||
41 | return validator(kb_info_json) | 41 | return validator(kb_info_json) |
42 | 42 | ||
43 | 43 | ||
44 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to show info for.') | 44 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to show info for.') |
45 | @cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.') | 45 | @cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.') |
46 | @cli.subcommand('Generate an info.json file for a keyboard.', hidden=False if cli.config.user.developer else True) | 46 | @cli.subcommand('Generate an info.json file for a keyboard.', hidden=False if cli.config.user.developer else True) |
47 | @automagic_keyboard | 47 | @automagic_keyboard |
diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py index 7b4394291..ad6946d6c 100755 --- a/lib/python/qmk/cli/generate/layouts.py +++ b/lib/python/qmk/cli/generate/layouts.py | |||
@@ -5,7 +5,7 @@ from milc import cli | |||
5 | from qmk.constants import COL_LETTERS, ROW_LETTERS | 5 | from qmk.constants import COL_LETTERS, ROW_LETTERS |
6 | from qmk.decorators import automagic_keyboard, automagic_keymap | 6 | from qmk.decorators import automagic_keyboard, automagic_keymap |
7 | from qmk.info import info_json | 7 | from qmk.info import info_json |
8 | from qmk.keyboard import keyboard_folder | 8 | from qmk.keyboard import keyboard_completer, keyboard_folder |
9 | from qmk.path import is_keyboard, normpath | 9 | from qmk.path import is_keyboard, normpath |
10 | 10 | ||
11 | usb_properties = { | 11 | usb_properties = { |
@@ -17,7 +17,7 @@ usb_properties = { | |||
17 | 17 | ||
18 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') | 18 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') |
19 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") | 19 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") |
20 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to generate config.h for.') | 20 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate config.h for.') |
21 | @cli.subcommand('Used by the make system to generate layouts.h from info.json', hidden=True) | 21 | @cli.subcommand('Used by the make system to generate layouts.h from info.json', hidden=True) |
22 | @automagic_keyboard | 22 | @automagic_keyboard |
23 | @automagic_keymap | 23 | @automagic_keymap |
diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 91759d26c..41c94e16b 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py | |||
@@ -8,7 +8,7 @@ from milc import cli | |||
8 | from qmk.decorators import automagic_keyboard, automagic_keymap | 8 | from qmk.decorators import automagic_keyboard, automagic_keymap |
9 | from qmk.info import info_json | 9 | from qmk.info import info_json |
10 | from qmk.json_schema import json_load | 10 | from qmk.json_schema import json_load |
11 | from qmk.keyboard import keyboard_folder | 11 | from qmk.keyboard import keyboard_completer, keyboard_folder |
12 | from qmk.path import is_keyboard, normpath | 12 | from qmk.path import is_keyboard, normpath |
13 | 13 | ||
14 | 14 | ||
@@ -39,7 +39,7 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict): | |||
39 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') | 39 | @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') |
40 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") | 40 | @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") |
41 | @cli.argument('-e', '--escape', arg_only=True, action='store_true', help="Escape spaces in quiet mode") | 41 | @cli.argument('-e', '--escape', arg_only=True, action='store_true', help="Escape spaces in quiet mode") |
42 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to generate config.h for.') | 42 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate config.h for.') |
43 | @cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) | 43 | @cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) |
44 | @automagic_keyboard | 44 | @automagic_keyboard |
45 | @automagic_keymap | 45 | @automagic_keymap |