1
0
Fork 0

[CLI] Add a subcommand for getting information about a keyboard (#8666)

You can now use `qmk info` to get information about keyboards and keymaps.

Co-authored-by: Erovia <Erovia@users.noreply.github.com>
This commit is contained in:
Zach White 2020-05-26 13:05:41 -07:00 committed by GitHub
parent 5d3bf8a050
commit 751316c344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 921 additions and 113 deletions

View file

@ -0,0 +1,20 @@
"""Removes C/C++ style comments from text.
Gratefully adapted from https://stackoverflow.com/a/241506
"""
import re
comment_pattern = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE)
def _comment_stripper(match):
"""Removes C/C++ style comments from a regex match.
"""
s = match.group(0)
return ' ' if s.startswith('/') else s
def comment_remover(text):
"""Remove C/C++ style comments from text.
"""
return re.sub(comment_pattern, _comment_stripper, text)