diff options
Diffstat (limited to 'lib/python/qmk/cli/info.py')
-rwxr-xr-x | lib/python/qmk/cli/info.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/info.py b/lib/python/qmk/cli/info.py index 6115e8f87..0d08d242c 100755 --- a/lib/python/qmk/cli/info.py +++ b/lib/python/qmk/cli/info.py | |||
@@ -10,7 +10,7 @@ from milc import cli | |||
10 | from qmk.json_encoders import InfoJSONEncoder | 10 | from qmk.json_encoders import InfoJSONEncoder |
11 | from qmk.constants import COL_LETTERS, ROW_LETTERS | 11 | from qmk.constants import COL_LETTERS, ROW_LETTERS |
12 | from qmk.decorators import automagic_keyboard, automagic_keymap | 12 | from qmk.decorators import automagic_keyboard, automagic_keymap |
13 | from qmk.keyboard import keyboard_completer, keyboard_folder, render_layouts, render_layout | 13 | from qmk.keyboard import keyboard_completer, keyboard_folder, render_layouts, render_layout, rules_mk |
14 | from qmk.keymap import locate_keymap | 14 | from qmk.keymap import locate_keymap |
15 | from qmk.info import info_json | 15 | from qmk.info import info_json |
16 | from qmk.path import is_keyboard | 16 | from qmk.path import is_keyboard |
@@ -124,12 +124,20 @@ def print_text_output(kb_info_json): | |||
124 | show_keymap(kb_info_json, False) | 124 | show_keymap(kb_info_json, False) |
125 | 125 | ||
126 | 126 | ||
127 | def print_parsed_rules_mk(keyboard_name): | ||
128 | rules = rules_mk(keyboard_name) | ||
129 | for k in sorted(rules.keys()): | ||
130 | print('%s = %s' % (k, rules[k])) | ||
131 | return | ||
132 | |||
133 | |||
127 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to show info for.') | 134 | @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to show info for.') |
128 | @cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.') | 135 | @cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.') |
129 | @cli.argument('-l', '--layouts', action='store_true', help='Render the layouts.') | 136 | @cli.argument('-l', '--layouts', action='store_true', help='Render the layouts.') |
130 | @cli.argument('-m', '--matrix', action='store_true', help='Render the layouts with matrix information.') | 137 | @cli.argument('-m', '--matrix', action='store_true', help='Render the layouts with matrix information.') |
131 | @cli.argument('-f', '--format', default='friendly', arg_only=True, help='Format to display the data in (friendly, text, json) (Default: friendly).') | 138 | @cli.argument('-f', '--format', default='friendly', arg_only=True, help='Format to display the data in (friendly, text, json) (Default: friendly).') |
132 | @cli.argument('--ascii', action='store_true', default=not UNICODE_SUPPORT, help='Render layout box drawings in ASCII only.') | 139 | @cli.argument('--ascii', action='store_true', default=not UNICODE_SUPPORT, help='Render layout box drawings in ASCII only.') |
140 | @cli.argument('-r', '--rules-mk', action='store_true', help='Render the parsed values of the keyboard\'s rules.mk file.') | ||
133 | @cli.subcommand('Keyboard information.') | 141 | @cli.subcommand('Keyboard information.') |
134 | @automagic_keyboard | 142 | @automagic_keyboard |
135 | @automagic_keymap | 143 | @automagic_keymap |
@@ -146,6 +154,10 @@ def info(cli): | |||
146 | cli.log.error('Invalid keyboard: "%s"', cli.config.info.keyboard) | 154 | cli.log.error('Invalid keyboard: "%s"', cli.config.info.keyboard) |
147 | return False | 155 | return False |
148 | 156 | ||
157 | if bool(cli.args.rules_mk): | ||
158 | print_parsed_rules_mk(cli.config.info.keyboard) | ||
159 | return False | ||
160 | |||
149 | # Build the info.json file | 161 | # Build the info.json file |
150 | kb_info_json = info_json(cli.config.info.keyboard) | 162 | kb_info_json = info_json(cli.config.info.keyboard) |
151 | 163 | ||