16
16
COL_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijilmnopqrstuvwxyz'
17
17
18
18
19
- def show_keymap (info_json , title_caps = True ):
19
+ def show_keymap (kb_info_json , title_caps = True ):
20
20
"""Render the keymap in ascii art.
21
21
"""
22
22
keymap_path = locate_keymap (cli .config .info .keyboard , cli .config .info .keymap )
@@ -36,7 +36,7 @@ def show_keymap(info_json, title_caps=True):
36
36
else :
37
37
cli .echo ('{fg_cyan}layer_%s{fg_reset}:' , layer_num )
38
38
39
- print (render_layout (info_json ['layouts' ][layout_name ]['layout' ], layer ))
39
+ print (render_layout (kb_info_json ['layouts' ][layout_name ]['layout' ], layer ))
40
40
41
41
42
42
def show_layouts (kb_info_json , title_caps = True ):
@@ -48,10 +48,10 @@ def show_layouts(kb_info_json, title_caps=True):
48
48
print (layout_art ) # Avoid passing dirty data to cli.echo()
49
49
50
50
51
- def show_matrix (info_json , title_caps = True ):
51
+ def show_matrix (kb_info_json , title_caps = True ):
52
52
"""Render the layout with matrix labels in ascii art.
53
53
"""
54
- for layout_name , layout in info_json ['layouts' ].items ():
54
+ for layout_name , layout in kb_info_json ['layouts' ].items ():
55
55
# Build our label list
56
56
labels = []
57
57
for key in layout ['layout' ]:
@@ -69,54 +69,54 @@ def show_matrix(info_json, title_caps=True):
69
69
else :
70
70
cli .echo ('{fg_blue}matrix_%s{fg_reset}:' , layout_name )
71
71
72
- print (render_layout (info_json ['layouts' ][layout_name ]['layout' ], labels ))
72
+ print (render_layout (kb_info_json ['layouts' ][layout_name ]['layout' ], labels ))
73
73
74
74
75
- def print_friendly_output (info_json ):
75
+ def print_friendly_output (kb_info_json ):
76
76
"""Print the info.json in a friendly text format.
77
77
"""
78
- cli .echo ('{fg_blue}Keyboard Name{fg_reset}: %s' , info_json .get ('keyboard_name' , 'Unknown' ))
79
- cli .echo ('{fg_blue}Manufacturer{fg_reset}: %s' , info_json .get ('manufacturer' , 'Unknown' ))
80
- if 'url' in info_json :
81
- cli .echo ('{fg_blue}Website{fg_reset}: %s' , info_json .get ('url' , '' ))
82
- if info_json .get ('maintainer' , 'qmk' ) == 'qmk' :
78
+ cli .echo ('{fg_blue}Keyboard Name{fg_reset}: %s' , kb_info_json .get ('keyboard_name' , 'Unknown' ))
79
+ cli .echo ('{fg_blue}Manufacturer{fg_reset}: %s' , kb_info_json .get ('manufacturer' , 'Unknown' ))
80
+ if 'url' in kb_info_json :
81
+ cli .echo ('{fg_blue}Website{fg_reset}: %s' , kb_info_json .get ('url' , '' ))
82
+ if kb_info_json .get ('maintainer' , 'qmk' ) == 'qmk' :
83
83
cli .echo ('{fg_blue}Maintainer{fg_reset}: QMK Community' )
84
84
else :
85
- cli .echo ('{fg_blue}Maintainer{fg_reset}: %s' , info_json ['maintainer' ])
86
- cli .echo ('{fg_blue}Keyboard Folder{fg_reset}: %s' , info_json .get ('keyboard_folder' , 'Unknown' ))
87
- cli .echo ('{fg_blue}Layouts{fg_reset}: %s' , ', ' .join (sorted (info_json ['layouts' ].keys ())))
88
- if 'width' in info_json and 'height' in info_json :
89
- cli .echo ('{fg_blue}Size{fg_reset}: %s x %s' % (info_json ['width' ], info_json ['height' ]))
90
- cli .echo ('{fg_blue}Processor{fg_reset}: %s' , info_json .get ('processor' , 'Unknown' ))
91
- cli .echo ('{fg_blue}Bootloader{fg_reset}: %s' , info_json .get ('bootloader' , 'Unknown' ))
85
+ cli .echo ('{fg_blue}Maintainer{fg_reset}: %s' , kb_info_json ['maintainer' ])
86
+ cli .echo ('{fg_blue}Keyboard Folder{fg_reset}: %s' , kb_info_json .get ('keyboard_folder' , 'Unknown' ))
87
+ cli .echo ('{fg_blue}Layouts{fg_reset}: %s' , ', ' .join (sorted (kb_info_json ['layouts' ].keys ())))
88
+ if 'width' in kb_info_json and 'height' in kb_info_json :
89
+ cli .echo ('{fg_blue}Size{fg_reset}: %s x %s' % (kb_info_json ['width' ], kb_info_json ['height' ]))
90
+ cli .echo ('{fg_blue}Processor{fg_reset}: %s' , kb_info_json .get ('processor' , 'Unknown' ))
91
+ cli .echo ('{fg_blue}Bootloader{fg_reset}: %s' , kb_info_json .get ('bootloader' , 'Unknown' ))
92
92
93
93
if cli .config .info .layouts :
94
- show_layouts (info_json , True )
94
+ show_layouts (kb_info_json , True )
95
95
96
96
if cli .config .info .matrix :
97
- show_matrix (info_json , True )
97
+ show_matrix (kb_info_json , True )
98
98
99
99
if cli .config_source .info .keymap and cli .config_source .info .keymap != 'config_file' :
100
- show_keymap (info_json , True )
100
+ show_keymap (kb_info_json , True )
101
101
102
102
103
- def print_text_output (info_json ):
103
+ def print_text_output (kb_info_json ):
104
104
"""Print the info.json in a plain text format.
105
105
"""
106
- for key in sorted (info_json ):
106
+ for key in sorted (kb_info_json ):
107
107
if key == 'layouts' :
108
- cli .echo ('{fg_blue}layouts{fg_reset}: %s' , ', ' .join (sorted (info_json ['layouts' ].keys ())))
108
+ cli .echo ('{fg_blue}layouts{fg_reset}: %s' , ', ' .join (sorted (kb_info_json ['layouts' ].keys ())))
109
109
else :
110
- cli .echo ('{fg_blue}%s{fg_reset}: %s' , key , info_json [key ])
110
+ cli .echo ('{fg_blue}%s{fg_reset}: %s' , key , kb_info_json [key ])
111
111
112
112
if cli .config .info .layouts :
113
- show_layouts (info_json , False )
113
+ show_layouts (kb_info_json , False )
114
114
115
115
if cli .config .info .matrix :
116
- show_matrix (info_json , False )
116
+ show_matrix (kb_info_json , False )
117
117
118
118
if cli .config_source .info .keymap and cli .config_source .info .keymap != 'config_file' :
119
- show_keymap (info_json , False )
119
+ show_keymap (kb_info_json , False )
120
120
121
121
122
122
@cli .argument ('-kb' , '--keyboard' , help = 'Keyboard to show info for.' )
0 commit comments